procedure TForm2.Timer1Timer(Sender: TObject); var h:HWND; begin h := FindWindow(nil,PAnsiChar('123')); if h > 0 then begin
//PostMessage(h,WM_SYSCOMMAND, SC_CLOASE,0);//现在这样写法不管用 SendMessage(h,WM_SYSCOMMAND, SC_CLOSE,0); end; if Application.messageBOX(PChar('是否继续?'), PChar('123'), MB_OKCANCEL + MB_ICONINFORMATION + MB_DEFBUTTON2 + MB_TOPMOST) = IDCANCEL then begin Exit; end end;