I used QProcess to start an external console program called client.exe.
CommProcess->start("E:/work/client.exe");
if (CommProcess
->state
() == QProcess::Starting) cout << "client program is starting" << endl;
else if (CommProcess
->state
() == QProcess::Running) cout << "client program is running" << endl;
else if (CommProcess
->state
() == QProcess::NotRunning) cout << "client program is NOT running" << endl
<< "Error Code : " << CommProcess->error() << endl;
QProcess *CommProcess = new QProcess();
CommProcess->start("E:/work/client.exe");
if (CommProcess->state() == QProcess::Starting)
cout << "client program is starting" << endl;
else if (CommProcess->state() == QProcess::Running)
cout << "client program is running" << endl;
else if (CommProcess->state() == QProcess::NotRunning)
cout << "client program is NOT running" << endl
<< "Error Code : " << CommProcess->error() << endl;
To copy to clipboard, switch view to plain text mode
It turns out with "client program is running". Seems everything is OK.
But actually it doesn't. Because I create a shared memory area in client.exe and open it in the current qt program. But I failed to open that area in current program.
If I run client.exe(both directly or using Visual C++ debugging model) before starting my qt program, everything just turns out OK.
Can anybody give me some hint ?
Bookmarks