Trying to launch an .exe from MQL4
using ShellExecuteW()
.
Does this command work only once, or not?
#import "shell32.dll" // MQL4-syntax-wrapper-Bo[#import]Container
// v-------------- caller-side interface to DLL
int ShellExecuteW( int hWnd,
int lpVerb,
string lpFile,
int lpParameters,
int lpDirectory,
int nCmdShow
);
#import // MQL4-syntax-wrapper-Eo[#import]Container
if ( cond == true ){
ShellExecuteW( 0, "open", "D:\\Execute.exe", "", "", 1 );
}
A: a short version
Maybe yes, maybe no.
A: a bit more indepth one [TLDR]
Fact: MT4 Terminal's process-control / process-management is nothing superior, however it allows you to integrate several lines of control over what happens inside ( and outside ... not only via
ShellExecuteW(...)
... ) the MT4 Terminal.MT4 Terminal supports the following processes per graph ( via built-in threads ):
{ 0 | 1 }
occurences of a singleton instance called MQL4-ExpertAdvisor{ 0 | 1 }
occurences of a singleton instance called MQL4-Script{ 0 | 1 ... n }
occurences of a functionally restricted instance called MQL4-TechnicalIndicatorThe nature of these instances differs in several ways, however in the closest relation to your question, each of the processes have both a mandatory part and a set of arbitrary parts.
Speaking in the original
MQL4
( one may have noticed, that since Build 7xx MQL4 language syntax has moved closer and closer towards MQL5, thus sometimes got labeled as MQL4.5 :o) )So, the exact location of your deployment code, that (re-)uses the generic DLL-service (
#import
-ed for both the compile-time alignment and the dynamic linking upon (re-use) decides how many times the external process has been asked to get invoked.Nota Bene
There are much smarter ways to integrate MT4 Terminal with external processes or remote processes ( Clouds & Grids ) than just a DLL-based spawn of just another blind & deaf unmanageable
<localhost>
process.Typically one needs both process-control and bidirectional communication between / among processes.
Do not hesitate to ask more.
MT4 ( with some additional tools ) can do.