Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3046

ShellExecute tries to launch .exe everytime even though it is already runniong.

$
0
0
Hey All,

I have written two programs. Both of them have a mutex so that only one instance of each can ever be run at a time.

Program one uses ShellExecute to send information to program two. Here's a code snippet:

Code:

if ( m_je->m_saveDCPProbePDF ) parameters = "savePDF";
else parameters = "dontSavePDF";

parameters += "*";

parameters += m_je->m_compilationPath;

parameters += "*";

parameters += m_je->m_dcpName;

ShellExecute( NULL, NULL, "DCPProbe.exe", parameters, progDir, SW_SHOWNORMAL );

The problem I have is that even though program 2 is all ready running, ShellExecute tries to launch it again, which of course it can't because of the mutex.

Is there a way to do this so that it uses the program already running rather than trying to launch a new one eveytime?

Thanks so much,

Steve Q. :-)

Viewing all articles
Browse latest Browse all 3046

Trending Articles