Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » TopWindow&PopUp, TrayIcon » How to remove the button [X] that closes the window?
Re: how to display dialog box without close button in window caption? [message #458 is a reply to message #456] Wed, 04 January 2006 08:18 Go to previous messageGo to previous message
gprentice is currently offline  gprentice
Messages: 260
Registered: November 2005
Location: New Zealand
Experienced Member


I'm wrong. It is possible to get rid of the close button and still have title bar.

Here's how to do it in VB. I'm sure it's possible in C++ too Smile

http://www.devx.com/tips/Tip/14284


In C++ (info found on usenet)


Disable the close button

EnableMenuItem( GetSystemMenu( hWnd, 0 ), SC_CLOSE, MF_BYCOMMAND
|MF_DISABLED );



Remove the close button (I think).

HMENU hMenu = GetSystemMenu( hWnd, 0 );
int nNbItems = GetMenuItemCount(hMenu);
RemoveMenu(hMenu, nNbItems - 1, MF_BYPOSITION);
RemoveMenu(hMenu, nNbItems - 2, MF_BYPOSITION);


And handle WM_SYSCOMMAND (SC_CLOSE) if you want also to disable [Alt]+[F4]


Graeme
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How do I change main window and dialog title font size
Next Topic: TopWindow when Close override show exception unduly
Goto Forum:
  


Current Time: Sat May 04 03:01:05 CEST 2024

Total time taken to generate the page: 0.02298 seconds