首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ Builder >

怎么得到ShellExecute打开的应用程序的handle以关闭程序

2012-02-14 
如何得到ShellExecute打开的应用程序的handle以关闭程序 - C++ Builder / Windows SDK/APIRT用ShellExecut

如何得到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);} 

热点排行