Download MetaTrader 5

how can i use mql to run extern ".exe" program

To add comments, please log in or register
Track all payments in your profile. It is easy!
1
24
1 2008.09.05 15:16 

how can i use mql to run extern ".exe" program?

thanks everyone

antslag
109
antslag 2008.09.05 16:26  

it must work, but it isn't

#import "shell32.dll"
    int ShellExecute(int hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd);
#import



int init() {

    ShellExecute(NULL, "open", "C:\\Windows\\Notepad.exe", NULL, NULL, 10);

    return (0);

}
antslag
109
antslag 2008.09.05 16:27  
try to write your own dll
Ray
2650
Ray 2008.09.05 18:10  

Instead of opening notepad, request to open a file associated with notepad:

Example from a working script:

string theFile = path+"\\experts\\files\\reports\\MarketInfo_"+AccountCompany()+"_.txt";
ShellExecuteA(0, "open", theFile, NULL, NULL, 1);

antslag
109
antslag 2008.09.05 19:01  

yes, the problem was in ShellExecute(), it takes unicode strings.. ShellExecuteA() is true variant.

1
24
1 2008.09.08 17:58  

HI ~~~everybody~~~

help ~~~


dll lib must be in system32 folder ???

istvan gyori
25
istvan gyori 2008.09.08 19:00  
phy:

Instead of opening notepad, request to open a file associated with notepad:

Example from a working script:

string theFile = path+"\\experts\\files\\reports\\MarketInfo_"+AccountCompany()+"_.txt";
ShellExecuteA(0, "open", theFile, NULL, NULL, 1);

Hello,



It seems very good. But still not working. Could you give the whole script. Maybe it could help.

For example the "path" variable not definied.

Thanks a lot for your help.

Ray
2650
Ray 2008.09.09 01:33  

string path = TerminalPath();

...

That is just an example... assign theFile with a string that represents the full path of the file you want to open, not my file, which doesn't exist on your machine.

1
24
1 2008.09.09 17:12  
thank all very much~~~
fadisal
10
fadisal 2016.08.18 08:29  
why I got this errors?
Carl Schreiber
6580
Carl Schreiber 2016.08.18 09:26  

Which error?

12
To add comments, please log in or register