我正在尝试启动 iexplore.exe
,让它运行5秒钟,然后再关闭它。
iexplore
opens just fine however it doesn t close when I call the PostThreadMessage.
Can anyone see what I m doing wrong? Here is my code:
CString IEPath = "C:\Program Files\Internet Explorer\IEXPLORE.EXE";//GetIEPath();
//IEPath += + url;
std::string strCommand((LPCTSTR)IEPath);
PROCESS_INFORMATION procinfo;
STARTUPINFO startupinfo;
GetStartupInfo(&startupinfo);
CreateProcess(
NULL,
(char *)strCommand.c_str(),// name of executable module
NULL, // lpProcessAttributes
NULL, // lpThreadAttributes
false, // handle inheritance option
CREATE_SHARED_WOW_VDM, // creation flags
NULL, // new environment block
NULL, // current directory name
&startupinfo, // startup information
&procinfo // process information
);
Sleep(5000);
::PostThreadMessage(procinfo.dwThreadId, WM_QUIT, 0, 0); //<---Dosent Close internet explorer!
有人知道我哪里做错了吗?还是有更好的方法可以解决这个问题吗?