Download MetaTrader 5
To add comments, please log in or register
Deposit to your account using bank cards via Gate2Shop
programmierer
74
programmierer 2016.07.20 09:18 

Hallo,

Is there a safety method to execute an exe-file from an EA? 

traderdoc 

Ovo Cz
2958
Ovo Cz 2016.07.20 12:55  
By "safety", do you mean running the antivirus software first?
programmierer
74
programmierer 2016.07.20 13:21  

Sorry, no, I mean one method that really works.

How can I run an exe-file from an EA out? 

Carl Schreiber
5967
Carl Schreiber 2016.07.20 13:35  

SellExecute:

#import "shell32.dll"
// https://www.mql5.com/en/articles/1467
int ShellExecuteW(int hWnd,int lpVerb,string lpFile,string lpParameters,string lpDirectory,int nCmdShow);
#import
whroeder1
13656
whroeder1 2016.07.20 14:03  
programmierer
74
programmierer 2016.07.20 14:04  

ShellExecuteW or ShellExecuteA?

Thank you all.

@WHRoeder: 

 ShellExecuteW(NULL,"open","c:\\users\\route206\\desktop\\test.bat",NULL,NULL,1);

  1. The first argument is an int, use 0 not NULL.
  2. The last two are strings. Try passing empty strings ("") not NULLS.
But the second argument is int, but here with "open" a string?
whroeder1
13656
whroeder1 2016.07.20 14:31  
  1. Strings have been Unicode since Build 600 17.02.2014. You must use the W version.
  2. Where do you get that idea?
    HINSTANCE ShellExecute(
      _In_opt_ HWND    hwnd,
      _In_opt_ LPCTSTR lpOperation,
      _In_     LPCTSTR lpFile,
      _In_opt_ LPCTSTR lpParameters,
      _In_opt_ LPCTSTR lpDirectory,
      _In_     INT     nShowCmd
    );
    -- ShellExecute function (Windows)
    
    

/
To add comments, please log in or register