可以将窗口的关闭按钮Disabled.
procedure TForm1.FormCreate(Sender: TObject);
Const xMenuID = 10;
var hmenu:integer;
MII : MENUITEMINFO;
begin
hMenu := GetSystemMenu(Handle, false);
MII.cbSize := SizeOf(MII);
MII.cch := SizeOf(MII.dwTypeData);
MII.fMask := MIIM_STATE;
MII.wID := SC_CLOSE;
GetMenuItemInfo(hMenu, SC_CLOSE, False, MII);
MII.wID := xMenuID;
MII.fMask := MIIM_ID;
SetMenuItemInfo (hMenu, SC_CLOSE, False, MII);
MII.fState := MII.fState Or MFS_GRAYED;
MII.fMask := MIIM_STATE;
SetMenuItemInfo(hMenu, MII.wID, False, MII);
SendMessage(Handle, WM_NCACTIVATE, 0, 1);
enn;