Open .exe from DLL called by MT4

 

Hi,


I have the following problem:

I want to call an .exe within my DLL which I use in an EA.

Therefore I tried different C++ ways of doing this. Like system(start "program.exe"), ShellExecute() or CreateProcess.

All of them fail if used in the DLL but succeed if they are implemented in an separat executable.

The error that occurs is always that the file could not be found although it is in the same directory.

Except this problem the DLL works fine.

Does everyone know what the reason is and how to solve it?


Thanks very much!

 

what do you mean by: "the same directory"?

MetaTrader is run from within the metatrader directory (the same directory where terminal.exe is). It doesn't matter where all its individual modules (dlls that it loads from many places) are located, there is only one "same directory" for the entire process and this is the terminal.exe process.

 

Hi 7bit,


actually I tried also to copy the .exe in the same folder like terminal.exe but this does not function, too. Do you have another suggestion where to put the .exe so that mt4 can find it?


Thanks!

 

Just to let you all know:


The location where the process is executed is the "system32"-folder.

Not as easy as I thought...

Reason: