Solved

Disabling close button

Posted on 1998-07-27
4
358 Views
Last Modified: 2013-11-20
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
0
Comment
Question by:erajoj
  • 3
4 Comments
 
LVL 8

Accepted Solution

by:
trestan earned 300 total points
ID: 1319817
Use these functions:GetSystemMenu(),GetMenuItemCount(), RemoveMenu() more...
0
 
LVL 8

Expert Comment

by:trestan
ID: 1319818
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
 
LVL 8

Expert Comment

by:trestan
ID: 1319819
Put the codes under the OnCreate() function. For MDI child windows, add member function for WM_CREATE message in CChildFrame class.
0
 
LVL 4

Author Comment

by:erajoj
ID: 1319820
Thanx a bunch for the swift answer!
This is for the Delphi group, hope you don't mind.

/// John
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now