Download MetaTrader 5

shell execuate not executing

To add comments, please log in or register
Publish programs in Code Base. Improve your rating!
SELVAN26
11
SELVAN26 2016.11.11 15:12 

Dear sir,


I had try to execute the Following Programme

//+------------------------------------------------------------------+
//|                                                            1.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict


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



//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- create timer
   EventSetTimer(30);
      
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- destroy timer
   EventKillTimer();
      
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
  
  }
//+------------------------------------------------------------------+
//| Timer function                                                   |
//+------------------------------------------------------------------+
void OnTimer()
  {
//---
  

  
    ShellExecuteW (0,0,"WindowsApplication100.exe","C:\\Program Files\AUTOTRADER\\projects\\WindowsApplication100\\WindowsApplication100\\bin\\Debug\\","",1);  
  
      
  
  }
//+------------------------------------------------------------------+

But  My Programming is not Running,

When i try to run with this same code for running "Notepad.exe", it is working Fine

I request you to Correct my code,


Thank you

Yours Respectively

Automated Trading and Strategy Testing
Automated Trading and Strategy Testing
  • www.mql5.com
MQL5: language of trade strategies built-in the MetaTrader 5 Trading Platform, allows writing your own trading robots, technical indicators, scripts and libraries of functions
Jian Chen
Moderator
3621
Jian Chen 2016.11.11 16:10  
If your application can run correctly in the Windows Explorer, it could be a dependency related issue. That is, your executable depends on some DLL(s) which is not located at the working directory, current directory and other directories specified in the "PATH" environment variable. 
Jian Chen
Moderator
3621
Jian Chen 2016.11.11 16:14  
BTW, when you post code in the forum, please use the "SRC" feature of the editor. This time i did it for you :)
whroeder1
14532
whroeder1 2016.11.11 16:19  
"C:\\Program Files\AUTOTRADER\\projects\\WindowsApplication100\\WindowsApplication100\\bin\\Debug\\"

Bad path. You have no directory "Program FilesAUTOTRADER" under C:\

It runs notepad because that is in your PATH variable.

SELVAN26
11
SELVAN26 2016.11.11 17:26  
whroeder1:
"C:\\Program Files\AUTOTRADER\\projects\\WindowsApplication100\\WindowsApplication100\\bin\\Debug\\"

Bad path. You have no directory "Program FilesAUTOTRADER" under C:\

It runs notepad because that is in your PATH variable.



THANK YOU SO MUCH FOR THE PROMPT REPLAY


ONCE AGAIN THANK YOU SIR

To add comments, please log in or register