Solved

Disabling close button

Posted on 1998-07-27
4
362 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.

839 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