Q: How do I manipulate (enable/disable) the 'close'
item on the default system menu (i.e. the menu which drops down from the
system box when the user clicks it or presses the ALT-SPACEBAR key combination?
A:
procedure TMainForm.WMInitMenuPopup(var Msg : TWMInitMenuPopup);
begin
if ( Msg.SystemMenu ) then
EnableMenuItem(Msg.MenuPopup, SC_Close, MF_ByCommand
or MF_Grayed);
end;