如果一个工程中有若干个form,在程序运行中若要彻底关闭其中的一个窗体
除了点击右上角的小叉叉外,也可以在form的close事件中添加一句话
procedure TLockScreen.FormClose(Sender: TObject; var Action: TCloseAction);
var
tmp: integer;
rtScreen: TRect;
begin
tmp := 0;
SetWindowPos(LockScreen.Handle, Hwnd_Notopmost, 0, 0, 0, 0, (SWP_NOMOVE or SWP_NOSIZE)); //取消最上
SystemParametersInfo(SPI_SETFASTTASKSWITCH, 0, @tmp, 0);
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, @tmp, 0);
rtScreen := Rect(0, 0, Screen.Width, Screen.Height);
ClipCursor(@rtScreen);
action:= caFree;//增加了这一句会彻底关闭这个窗体
end;