A程序利用ShellExecute調用B.exe和C.exe,那麼如何實現當A退出的時候B、C也同時關閉!!!
解决方案 »
- delphi窗体 问题
- TEdit.Text 的赋值
- serversocket有时接收不到client发过来的数据,为什么?
- 父窗口定义为应用程序的主窗体,否则程序编译会出错。
- delphi 与 SQL Server 2000,请高手看看
- 代码中两处使用Tstrings类同一实例的add方法如果不在一个过程中是不是第二处会自动指向下一行?
- 在程序中如何得知SQL SERVER的某张表已经建立了那些索引
- 在delphi中如何连接sql server的数据库,在线急等!!!
- 谁知道bcb7什么时候出。
- 用delphi开发web应用程序,能象vb那样方便么?
- 大家看看,给个思路!
- TList能释放所有类型的对象吗?
var
hPreWnd:HWND;
begin
hPreWnd:=FindWindow(PChar(AClass),PChar(ACaption));
if hPreWnd<>0 then
PostMessage(hPreWnd,WM_QUIT,0,0);
end;//AClass是类名,ACaption是标题 MClossWindow('这是A程序的主窗口类名如TForm1','这是A程序的主窗口标题');
lppe:tprocessentry32;
sshandle:thandle;
hh:hwnd;
found:boolean;
begin
sshandle:=createtoolhelp32snapshot(TH32CS_SNAPALL,0);
found:=process32first(sshandle,lppe);
while found do
begin
if uppercase(extractfilename(lppe.szExeFile))='PROJECT2.EXE' then
begin
hh:=OpenProcess(PROCESS_ALL_ACCESS,true,lppe.th32ProcessID);
TerminateProcess(hh,0);
end;
found:=process32next(sshandle,lppe);
end;
end;