You have to analyze the return value of MessageBox function in order to know which button was clicked.
int result = MessageBox(Confirmation,"0",MB_OKCANCEL);
The return value is the code see:https://www.mql5.com/en/docs/constants/io_constants/messbconstants
- www.mql5.com
You have to analyze the return value of MessageBox function in order to know which button was clicked.
The return value is the code see:https://www.mql5.com/en/docs/constants/io_constants/messbconstants
HI Marco,
Thanks for your reply, but unfortunately i am still confused.
which section do I change to your coding.. i tried both, but am still getting errors.
should I be changing this coding to your code above or the second section?
int MessageBox( string Confirmation, string Caption="Close All", int Flag=0 );
2nd section:
if(id==CHARTEVENT_OBJECT_CLICK && sparam==name_closeall && TradesCount()>0 ) { MessageBox("Confirmation","0",MB_OKCANCEL); PlaySound("ok.wav"); Print("Close All Button"); CloseAllOpenPositions(MaxSlippage); myOrderDelete(); ObjectSetInteger(ChartID(),name_closeall,OBJPROP_STATE,0); }
I tried this with both "Confirmation"
I still get the error "'MessageBox' - ambiguous call to overloaded function with the same parameters
without the " "
i also get the error Confirmation - undeclared identifier
Thanks
int result = MessageBox("test");
if(result == IDOK) { Alert("OK button has been pressed"); } if(result == IDCANCEL) { Alert("Cancel button has been pressed"); }
Please read the links i provided in my previous post.
Marco vd Heijden:
Please read the links i provided in my previous post.
Thanks..
Works great..
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
HI,, I have an EA that works great..
I added a Button to Close all trades, but I want to add a messagebox that confirms the entry..
EG.. Are you sure Yes/No/Cancel.
But I can get the message box to come up, but when I hit Cancel it still closes the open orders.
I have searched the documentation, but can't find any examples of how it should be coded.
Any help would be gratefully appreciated.