procedure TForm1.Button1Click(Sender: TObject); var H:THandle; P:DWORD; begin H:=FindWindow(nil,'无标题 - 记事本'); if H<>0 then begin GetWindowThreadProcessId(H,@P); if P<>0 then TerminateProcess(OpenProcess(PROCESS_TERMINATE,False,P),$FFFFFFFF); end; end;
var
H:THandle;
P:DWORD;
begin
H:=FindWindow(nil,'无标题 - 记事本');
if H<>0 then
begin
GetWindowThreadProcessId(H,@P);
if P<>0 then
TerminateProcess(OpenProcess(PROCESS_TERMINATE,False,P),$FFFFFFFF);
end;
end;