楼上的不够猛,如果记事本等变化了,wm_close会提示是否保存等,
用wm_destroy比较猛,强行关闭,挥一挥衣袖,不带一片云彩
procedure TForm1.Button1Click(Sender: TObject);
var
wnd: thandle;
begin
wnd:=Findwindow(nil,'b.txt - 记事本');
if wnd>0 then
// sendMessage(wnd,WM_CLOSE,0,0);//发送关闭消息
SendMessage(wnd,WM_DESTROY,0,0);
end;