Execute an exe-file from MQL

Back to topics list To post a new topic, please log in or register
avatar
34
traderdoc 2016.07.20 11:18
 

Hallo,

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

traderdoc 

avatar
1109
Ovo 2016.07.20 14:55 #
 
By "safety", do you mean running the antivirus software first?
avatar
34
traderdoc 2016.07.20 15:21 #
 

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

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

avatar
2017
gooly 2016.07.20 15: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
avatar
12985
avatar
34
traderdoc 2016.07.20 16: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?
avatar
12985
WHRoeder 2016.07.20 16: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)
    
    

Back to topics list  

To add comments, please log in or register