Check if program already running from shellexecuteW

 

Hi,

my EA will launch a program using ShellExecuteW and the program will create an XML file that the EA will copy it for further processing. Since the program could close itself due to error I launch the program for every 40 second. The arise between EA read the XML file and the countdown, there's a time when it's time to launch the program before EA read the file and opening the program for the second time and interrupting the flow of the EA. Is there a way to stop the EA to launch the program is the program already launch, like if the program is launch skip launching the program using ShellExecuteW?

 
Luandre Ezra:

Hi,

my EA will launch a program using ShellExecuteW and the program will create an XML file that the EA will copy it for further processing. Since the program could close itself due to error I launch the program for every 40 second. The arise between EA read the XML file and the countdown, there's a time when it's time to launch the program before EA read the file and opening the program for the second time and interrupting the flow of the EA. Is there a way to stop the EA to launch the program is the program already launch, like if the program is launch skip launching the program using ShellExecuteW?

I would make the program run just once and then end. Every time the EA needs to update the file, it launches the program.

A better implementation would be to make the program be a DLL, import the DLL into the EA, and call a function inside the DLL, returning the XML as string for further processing.
 

The problem is that the program could experiencing error and it close itself and currently I have no idea why the error occurred (already looked everywhere but failed to find the solution.