程序隐藏后等另一进程退出再显示出来,如何实现? 我在一个程序A中用ShellExecute去调用另一个程序B,然后A隐藏,怎么做到等B关闭后A再Show出来呢?先谢谢大家! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不停的FINDWINDOW,如果找不到B,就Show出来 function Compression(p:pointer):dword;stdcall;//WINRAR压缩文件,你也可以换成别的文件var SHExecInfo:SHELLEXECUTEINFO; tmpdir:string; ExitCode: cardinal;begintmpdir:=GetTempDirectory;SHExecInfo.cbSize :=sizeof(SHELLEXECUTEINFO);SHExecInfo.fMask:=SEE_MASK_NOCLOSEPROCESS;SHExecInfo.Wnd:=MainFm.Handle;SHExecInfo.lpVerb:='open';SHExecInfo.lpFile:='WinRAR.exe';//文件名SHExecInfo.lpParameters:= pchar('a -s -y '+'"'+tmpdir+'tmp.rar'+'" "'+rec.Maindir+'"');//参数设置SHExecInfo.lpDirectory:=nil;SHExecInfo.nShow:= SW_HIDE;SHExecInfo.hInstApp:=MainFm.Handle;;ShellExecuteEx(@SHExecInfo);GetExitCodeProcess(SHExecInfo.hProcess,ExitCode);while ExitCode=STILL_ACTIVE do begin //循环等待直到winrar压缩完成GetExitCodeProcess(SHExecInfo.hProcess,ExitCode);sleep(10);Application.ProcessMessages;end;CloseHandle(SHExecInfo.hProcess);end;CompressionHandle :=CreateThread(nil,0,@Compression,nil,0,ID1);//这里写隐藏程序的代码if WaitForSingleObject(CompressionHandle , INFINITE) = WAIT_OBJECT_0 then //等待压缩完毕begin//这里写显示程序的代码end; SHExecInfo.nShow:= SW_HIDE; 这里是隐藏,你要换成正常显示 叫shownormal吧 hongqi162大哥!再请教鼠标事件的问题! 求助各位大侠一个莫名其妙的问题! 路过不能错过,快来拣分~~~服务器/客户端程序开发问题 急!怎样在dbgird里使某字段里的值为空,再又如何往里输入其他的值呢? 高分求救!编译问题?????? 请问谁有第三方控件 ADOQuery的问题!!!!! code editor中的汉字太难看了! 提示 第一行:'='附近有语法错误 急!如何编程使用串口接收电子称数据 怎么把JPEG、BMP,wmf等Timage支持的格式转化为TIFF? 自定义类型释放的问题
var
SHExecInfo:SHELLEXECUTEINFO;
tmpdir:string;
ExitCode: cardinal;
begin
tmpdir:=GetTempDirectory;
SHExecInfo.cbSize :=sizeof(SHELLEXECUTEINFO);
SHExecInfo.fMask:=SEE_MASK_NOCLOSEPROCESS;
SHExecInfo.Wnd:=MainFm.Handle;
SHExecInfo.lpVerb:='open';
SHExecInfo.lpFile:='WinRAR.exe';//文件名
SHExecInfo.lpParameters:= pchar('a -s -y '+'"'+tmpdir+'tmp.rar'+'" "'+rec.Maindir+'"');//参数设置
SHExecInfo.lpDirectory:=nil;
SHExecInfo.nShow:= SW_HIDE;
SHExecInfo.hInstApp:=MainFm.Handle;;
ShellExecuteEx(@SHExecInfo);
GetExitCodeProcess(SHExecInfo.hProcess,ExitCode);
while ExitCode=STILL_ACTIVE do begin //循环等待直到winrar压缩完成
GetExitCodeProcess(SHExecInfo.hProcess,ExitCode);
sleep(10);
Application.ProcessMessages;
end;
CloseHandle(SHExecInfo.hProcess);
end;CompressionHandle :=CreateThread(nil,0,@Compression,nil,0,ID1);
//这里写隐藏程序的代码
if WaitForSingleObject(CompressionHandle , INFINITE) = WAIT_OBJECT_0 then //等待压缩完毕
begin
//这里写显示程序的代码
end;