-
August 31st, 2001, 01:08 PM
#1
How to remove close button?
I'm trying to remove the close button from the top right of my dialog with no luck. I want to keep the icon on the top right of the window and I don't want to just disable the close button, I need to remove it. Is there any way of doing this? I can't find a solution anywhere.
Thanks.
Dan.
-
August 31st, 2001, 01:10 PM
#2
Re: How to remove close button?
That should read "icon on the top left of the window"
Dan.
-
August 31st, 2001, 01:14 PM
#3
Re: How to remove close button?
Uncheck the System Menu box under the Style tab of the properties of your dialog box.
-
August 31st, 2001, 01:28 PM
#4
Re: How to remove close button?
That doesn't work. It removes the icon from the top left. I need to keep the icon.
Dan.
-
August 31st, 2001, 07:13 PM
#5
Re: How to remove close button?
Hi,
Use this code.
CMenu *pMenu = GetSystemMenu(FALSE);
// To disable the close icon and the system close menu
pMenu->DeleteMenu(SC_CLOSE,MF_BYCOMMAND);
All Luck.
http://www.geocities.com/contactgirish/homepage.html >>> VC++ Links, Code, Downloads & Notes.
-
August 31st, 2001, 11:27 PM
#6
Re: How to remove close button?
That doesn't work either. It only disables the button. I need to remove it.
Dan.
-
December 22nd, 2001, 12:00 AM
#7
Re: How to remove close button?
ModifyStyle( WS_SYSMENU, 0, 0 );
-
December 24th, 2001, 01:21 AM
#8
Re: How to remove close button?
In Resource editor, open Dialog property dialog,
in "Styles" tab, uncheck out "System Menu".
HI, :-)....
Nice to meet u.
If i am senseless and i could answer your question, i will.
-
November 17th, 2003, 06:36 AM
#9
The key point is keeping the icon on.
It seems there is no solution to remove "X" (close button) while keeping the icon.....
None of the above solution work.
-
November 17th, 2003, 08:23 AM
#10
Well there may be an easier way, but I am not aware of it.
Follow VGirish's suggestion and then handle the WM_NCPAINT
message and paint the caption yourself including the sysmenu
icon, but don't paint the close button.
Wakeup in the morning and kick the day in the teeth!! Or something like that.
"i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."
-
November 17th, 2003, 09:33 AM
#11
There's no magic solution that will keep the system menu but remove the X button; you'll have to do what souldog suggests and owner-draw the title bar. Its not too difficult, really; just a nuisance.
-
December 11th, 2003, 10:31 AM
#12
wndclass.style = CS_HREDRAW | CS_VREDRAW ;//| CS_NOCLOSE
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
-
December 12th, 2003, 12:52 PM
#13
Originally posted by souldog
Well there may be an easier way
You are right. Unfortunately, there is no easier way and VGirish (Hi VGirish) solution is the only one that will achieve desired results.
I wish one day responders would test answers before posting
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
September 9th, 2004, 06:39 AM
#14
Re: How to remove close button?
Why dont you set the form style so that both the icon and close button are not visible, then BitBlt the icon and caption text onto the caption of the form. This is possible in VB so it MUST be possible in C++
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|