How to shutdown another MT4 instance. - page 2

 
paulepanke:

Sending WM_CLOSE to a window in effect is the same as clicking the little cross in the top right corner of the application's main window title bar. The app might ask you to save unsaved changes (ie. modified files etc.) before it shuts down. To give a complete example this forum is the wrong place. It's not only calling ShellExecute() or CreateProcess(), you have to wait until the app initialized itself, creates all their windows and threads and enters idle state. From this point on it will respond to your shutdown request in a defined way. Everything else leads to unpredictable crashes.

You might consider the brutal way to go by simply killing the process (as the Task Manager does) but that's not recommended either. Again, to advanced for this forum. http://www.codeproject.com/Articles/18962/Kill-Application-Using-Win32-APIs

pp

It seems that a reliable solution is more complex than I thought. It is not an easy mq4 issue, especially working with structures is cumbersome in mq4. Also the above linked solution (I mean this: https://www.mql5.com/en/forum/107527) is using C++ and CreateProcess.

Thank you for your detailed explanation!

 
erzo:

It seems that a reliable solution is more complex than I thought. It is not an easy mq4 issue, especially working with structures is cumbersome in mq4. Also the above linked solution (I mean this: https://www.mql5.com/en/forum/107527) is using C++ and CreateProcess.

Avoid the problem, let the new process shut itself down. When I'm done for the day, I go to bed - I don't expect or want someone else to sneak up and hit me over the head.
Reason: