我有以下代码从Windows服务启动程序。当程序具有UI时,我可以看到它在会话0中运行,但是该过程未显示在任务管理器中。那么,如何知道无UI程序是否已由服务启动并且运行正常?
SHELLEXECUTEINFO sei;
ZeroMemory( &sei, sizeof( SHELLEXECUTEINFO ) );
sei.cbSize = sizeof( SHELLEXECUTEINFO );
sei.fMask = 0;
sei.lpVerb = NULL;
sei.nShow = SW_HIDE;
sei.lpFile = "display_A_Simple_Win32_Window.exe";
sei.lpParameters=L"";
最佳答案
LPCTSTR mName = "name.exe";
hnd = CreateMutex(NULL, TRUE, mName);
if(GetLastError()==ERROR_ALREADY_EXISTS && WAIT_ABANDONED != WaitForSingleObject(hnd, 0x180)){
....................
//name.exe was started//
................
}