5,696,576 members and growing! (15,044 online)
Email Password   helpLost your password?
General Programming » Programming Tips » General     Intermediate

Disable System Close Button on a Console Application

By John L. DeVito

This code is a simple way to disable the close button on a Windows Console Application. It can also be used to disable any of the system menu buttons
VC6, VC7, VC7.1, C++Windows, Win2K, WinXP, Win2003, Visual Studio, MFC, Dev

Posted: 6 Dec 2003
Updated: 6 Dec 2003
Views: 43,409
Bookmarked: 9 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
20 votes for this Article.
Popularity: 3.27 Rating: 2.51 out of 5
9 votes, 45.0%
1
2 votes, 10.0%
2
0 votes, 0.0%
3
6 votes, 30.0%
4
3 votes, 15.0%
5

Introduction

This program is a VERY simple one to demostrate how to disable the close button on a Windows Console App. When I was looking up how to do this, I failed to find anything to help me on the site save the forums.

In reality we simply need to call two separate functions GetSystemMenu() and DeleteMenu(). This same algorithm can be used to disable/enable ANY of the system menu buttons.

The entry point for YOUR code is in the else block after testing for MFC failure.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

John L. DeVito


I'm a programmer by hobby. I enjoy systems programming and algorithm analysis. I'm fluent in C and am now moving from linux to onjectesd oriented programming on the Windows platform, .NET as well as Native Windows programming. I hope to one day start my own micro-ISV.
Occupation: Architect
Location: United States United States

Other popular Programming Tips articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 12 of 12 (Total in Forum: 12) (Refresh)FirstPrevNext
Question#include "DisableCloseBtn.h"member000dreamsound0006:37 18 Jul '07  
AnswerRe: #include "DisableCloseBtn.h"memberJohn L. DeVito16:49 18 Jul '07  
GeneralEasier waymembersgtawol6:01 7 Aug '06  
Generalhow to add item to windows explorer popUp menuememberwow_tato7:29 24 Dec '03  
GeneralThis one is really easysussJesterka3:55 9 Dec '03  
GeneralRe: This one is really easymemberkha0s9:22 9 Dec '03  
GeneralWhy?memberdog_spawn13:42 7 Dec '03  
GeneralRe: Why?susshrabe23:22 7 Dec '03  
GeneralRe: Why?memberdog_spawn5:33 8 Dec '03  
GeneralRe: Why?memberThe___Dude10:02 6 Sep '07  
GeneralRe: Why?memberkha0s6:20 8 Dec '03  
GeneralRe: Why?memberAnthony_Yio17:03 10 Dec '03  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 6 Dec 2003
Editor: Nishant Sivakumar
Copyright 2003 by John L. DeVito
Everything else Copyright © CodeProject, 1999-2008
Web09 | Advertise on the Code Project