读书人

怎么得到ShellExecute打开的应用程序的

发布时间: 2012-02-14 19:19:19 作者: rapoo

如何得到ShellExecute打开的应用程序的handle以关闭程序 - C++ Builder / Windows SDK/API
RT
用ShellExecute打开的应用程序如何关闭??
打开:ShellExecute(CClientWnd::hWnd,A2W("open"),fileSet.back()->filePathName,A2W(""),A2W(""),SW_SHOW );
关闭:???

[解决办法]

C/C++ code
void __fastcall TForm1::Button1Click(TObject *Sender){    SHELLEXECUTEINFO   ShExecInfo   =   {0};    ShExecInfo.cbSize   =   sizeof(SHELLEXECUTEINFO);    ShExecInfo.fMask   =   SEE_MASK_NOCLOSEPROCESS;    ShExecInfo.hwnd   =   NULL;    ShExecInfo.lpVerb   =   NULL;    ShExecInfo.lpFile   =   "c:\\Timer.exe ";    ShExecInfo.lpParameters   =   " ";    ShExecInfo.lpDirectory   =   NULL;    ShExecInfo.nShow   =   SW_SHOW;    ShExecInfo.hInstApp   =   NULL;    ShellExecuteEx(&ShExecInfo);    Sleep(3000); //延时3秒后关闭刚才打开的程序    TerminateProcess(ShExecInfo.hProcess,INFINITE);} 

读书人网 >C++ Builder

热点推荐