I used QProcess to start an external console program called client.exe.
Qt Code:
  1. QProcess *CommProcess = new QProcess();
  2. CommProcess->start("E:/work/client.exe");
  3. if (CommProcess->state() == QProcess::Starting)
  4. cout << "client program is starting" << endl;
  5. else if (CommProcess->state() == QProcess::Running)
  6. cout << "client program is running" << endl;
  7. else if (CommProcess->state() == QProcess::NotRunning)
  8. cout << "client program is NOT running" << endl
  9. << "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 ?