On Microsoft Windows, this works:
mnu := GetSystemMenu(h, false);
EnableMenuItem(mnu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
But this does not work:
mnu := GetSystemMenu(h, false);
EnableMenuItem(mnu, SC_MOVE, MF_BYCOMMAND or MF_GRAYED);
Therefore, I know how to disable the Close menu item in a window, but not the Move item. How to do it?
Update
Of course, one alternative to using the very nice EnableMenuItem function is to use SetMenuItemInfo:
FillChar(info, sizeOf(info), 0);
with info do
begin
cbSize := sizeOf(info);
fMask := MIIM_STATE;
fState := MFS_GRAYED;
end;
SetMenuItemInfo(mnu, SC_MOVE, false, info);
But this again works fine for SC_CLOSE, but not for SC_MOVE!
Update 2
Despite the fact that the problem is solved in the sense that a working code was found that "does the job", so to speak, it would be interesting to hear hypotheses about the cause of the problem: why does SC_CLOSE work, but not SC_MOVE?
source
share