您的位置:首页 > 其它

启动一个进程,并让他等待接收消息

2008-05-13 10:19 507 查看
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
_T("explorer.exe"), // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
//wait a gracefully time
//so the window is created and is ready to answer messages.
::WaitForInputIdle(pi.hProcess,1000);
//m_hExplorerProcess=(DWORD)pi.hProcess;

//oops, this won't work
//if another explorer.exe instance exists
//the new process quits before EnumWindows
//::EnumWindows(EnumWindowsProc,(LPARAM)this);

// Close process and thread handles.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐