Disabling close button

Is there any way to disable (or even hide) a window caption's close button, i.e. the top right button of a ws_sysmenu style window. I can already prevent a window from closing, so that is not what I'm asking for.
I have seen MDI child windows with this button disabled, so there has to be a way?!
Since I don't ask a lot of questions, a good answer will be worth a bunch.

/// John
LVL 4
erajojAsked:
Who is Participating?
 
trestanConnect With a Mentor Commented:
Use these functions:GetSystemMenu(),GetMenuItemCount(), RemoveMenu() more...
0
 
trestanCommented:
Use GetSystemMenu to access the Control menu for copying and modification. The GetMenuItemCount function determines the number of items in the specified menu. The RemoveMenu function deletes a menu item from the specified menu. The DrawMenuBar function redraws the menu bar of the specified window. It should be easy to compile them together.
Or simpler:
CMenu *MyMenu; MyMenu = GetSystemMenu(FALSE);
 MyMenu->EnableMenuItem(SC_CLOSE,MF_DISABLED);


0
 
trestanCommented:
Put the codes under the OnCreate() function. For MDI child windows, add member function for WM_CREATE message in CChildFrame class.
0
 
erajojAuthor Commented:
Thanx a bunch for the swift answer!
This is for the Delphi group, hope you don't mind.

/// John
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.