?
Solved

Disabling close button

Posted on 1998-07-27
4
Medium Priority
?
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 8

Accepted Solution

by:
trestan earned 900 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

743 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