mql5 exec binary

To add comments, please log in or register
waza123
117
waza123  

How to execute my binary file with mql5 ?

something like

exec("c:\my_file.exe");

or maybe somehow import a dll which will do this ? please advice

the main reason why i need this, i want to create a full workspace screenshot and save it to folder, maybe there is a other method ?


ChartScreenShot() only saves chart, I need full mt5 workspace

Stanislav Korotky
22111
Stanislav Korotky  

Try searching the forum. This was already asked many times. Here is the example:

Forum on trading, automated trading systems and testing trading strategies

running an external application from within mql5 and sending arguments to that

figurelli, 2014.02.28 07:04

Note that ShellExecute lpParameters is the field for such parameters.

So just try this:

string myRunPath="notepad.exe";
string myFile="c:\\sample.txt";
ShellExecuteW(0,0,myRunPath,myFile,0,SW_SHOW);

waza123
117
waza123  
marketeer:

Try searching the forum. This was already asked many times. Here is the example:


thank you !


EDIT:

Full MT5 workspace screenshot

Solution for future people:

0. download screenshot-cmd.exe (open source / virus free)
https://code.google.com/p/screenshot-cmd/downloads/list

1. allow dll in settings

2. add this after include

#import "shell32.dll"
int ShellExecuteW(int hWnd,int lpVerb,string lpFile,string lpParameters,string lpDirectory,int nCmdShow);
#import

3. this code to button or somewhere

   string dir = "c:\\forex_deals\\"; // must contain screenshot-cmd.exe and this folder where all screens will be saved
   string exe=dir+"screenshot-cmd.exe";
   string params="-o \""+TimeToString(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS)+".png\"";
   StringReplace(params, ":", "-");
   ShellExecuteW(NULL, NULL,exe, params, dir, 0);  


Your welcome

To add comments, please log in or register