Run script from MQL5 indicator code

 

Hi,

This code used to work in MT4 and it was working in MT5 but not anymore.

It's the code that execute another program ex:Script from the code.


Is there anyone who know how to make it work in MQL5?

#import "user32.dll"
   int RegisterWindowMessageW(string MessageName);
   int SendMessageW (int hwnd, int msg, int wparam, char &Name[]);
   void keybd_event(int VirtualKey, int ScanCode, int Flags, int ExtraInfo);   
#import
//*------------------------------------------------------------------*
//STARTS A METATRADER PROGRAM
int StartProgram(int hWnd, string ProgramName, string ProgramType="Expert", bool AutomaticallyAcceptDefaults=true)
{  
   char pn[256];
   StringToCharArray(ProgramName , pn);
   
   int InternalMessageNumber = RegisterWindowMessageW("MetaTrader4_Internal_Message");
   
   int msg_number = 14;
   if(ProgramType=="Expert") msg_number = 14;
   if(ProgramType=="Indicator") msg_number = 15;
   if(ProgramType=="Script") msg_number = 16;
   
   int result = SendMessageW (hWnd, InternalMessageNumber, msg_number, pn);
   
   return(result);   
}
//*------------------------------------------------------------------*
Reason: