Ceck if the terminal.exe running or close

 

Hello guys,

how can I check if terminale.exe runnig or not ?

I tested by ShellExecuteA but :-(

Thank's

 

i think u have to do this with an external program, because if it's not running the EA doesn't work

anyway it's involving WINAPI

edit:

i have an idea

must terminals can't run from the same directory more than once (check it before), so u can just use a task scheduler to run the terminal every X min or whatever

 

Sorry, I have not been comprehensively.


I would like to with a EA detect if a terminal.exe (present in another directory) it is running. Is it possibile with DLL ?

Thank's

 

Count how many instances are running by generating a list and counting the lines.

Not compiled, not tested

@echo off
rem terminalsRunning.bat
tasklist | findstr "terminal.exe" >%1
string termPath   = TerminalPath(),
       termRuning = termPath + "\\TerminalsRunning.bat",
       filename   = WindowExpertName() + ".txt",
       filePath   = termPath + "\\experts\\files\\";
if (IsTesting())
       filePath   = termPath + "\\tester\\files\\";
if ( Shell("cmd.exe", "/C "+termRuning+" "+filePath){
   Sleep(10000); // Allow some time to execute.
   int handle = FileOpen(filename, FILE_CSV|FILE_READ, '~');
   if (handle < 1){ ... }
   else{
      int count = 0;
       while(true){
          string line = FileReadString(handle); if (line == "") break;
          count++;
       }
   }
}
Not compiled, not tested

See Terminal auto restart. - MQL4 forum

Reason: