可用如下代码:
var B_Hwnd:Hwnd;
begin
B_Hwnd:=Winprocs.FindWindow(nil,'软件显示信息');
//软件显示信息是该软件打开文件时在系统下方工具条上显示的信息:
if B_Hwnd<>0 then SendMessage(B_Hwnd,WM_CLOSE,0,0);
end;
var h1,h2:Thandle;
begin
h1 :=findwindow(nil,'待关闭软件的标题');
h2 :=Findwindow(nil,'打开文件有标题');
sendmessage(h1,wm_close,0,0);
sendmessage(h2,wm_close,0,0);
end;