Instead using WinExec function, I suggest you use ShellExeceuteW. To do that you need to create this bat file and call it using ShellExecuteW
//bat file
For /F "skip=1" %%a in ('wmic process where "ExecutablePath='D:\\Eightcap - MT5\\terminal64.exe'" get ProcessID') do taskkill /f /pid %%a
//call it using ShellExecuteW
int ret = ShellExecuteW(0, "open", "D:\\Taskkill.bat", "", "", 0); if(ret < 32) Print("Error code ", ret);
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, I want to close another MT5 instances. To do that I use WinExec function. This is how I do it,
It returns error 2. Is this a correct way to use WinExec?