Download MetaTrader 5

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

To add comments, please log in or register
1
24
1  

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

thanks everyone

antslag
109
antslag  

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  
try to write your own dll
Ray
2650
Ray  

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  

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

1
24
1  

HI ~~~everybody~~~

help ~~~


dll lib must be in system32 folder ???

istvan gyori
25
istvan gyori  
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  

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  
thank all very much~~~
fadisal
10
fadisal  
why I got this errors?
Carl Schreiber
6973
Carl Schreiber  

Which error?

12
To add comments, please log in or register