这是一个关闭应用程序的函数,可以获得窗口的句柄,
function TMainForm.CloseProgram: Boolean;
var
hWndClose : HWnd;
begin
hWndClose := FindWindow(pchar('RFTPSWindow'), nil);
while hWndClose<> 0 do
begin
if hWndClose <> 0 then
begin
SendMessage(hWndClose, WM_CLOSE, 0, 0);
Result := True;
end else
Result := False;
hWndClose := FindWindow(pchar('RFTPSWindow'), nil);
end;
end;