Click here to Skip to main content
15,867,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I know how to disable or remove the system menu and how to disable the
close('X') button.

But how to remove or setting visibility of close button to FALSE?

Is there any ID assigned to the close button?

How I can do it through programming?

Thanks
Posted
Updated 8-Sep-10 3:53am
v2
Comments
Dalek Dave 8-Sep-10 9:53am    
Edited for Grammar.

write following in OninitDialog

ModifyStyle(WS_SYSMENU,0,0);
 
Share this answer
 
Comments
Richard MacCutchan 8-Sep-10 12:48pm    
If you are going to do it in your initialization then you may as well remove it from your template in the first place.
Bhavin Jagad 9-Sep-10 0:17am    
ya you are right.

But i tried following but it doesn't work


CMenu* pSystemMenu = GetSystemMenu (FALSE);
pSystemMenu->EnableMenuItem (SC_CLOSE, // Disable it.
MF_BYCOMMAND ¦ MF_DISABLED);
pSystemMenu->DeleteMenu (SC_CLOSE, MF_BYCOMMAND); // Delete it.
Destiny777 1-Jun-12 13:20pm    
Thank you BJ... The ModifyStyle is exactly what I was looking to do.

I need the "Control Box" normally but if I pass a certain Command Line parameter which will then use the ModifyStyle function to do exactly what is necessary which is to hide the "Control Box"!

:)
I have encountered this in the past and have a feeling that if you delete the Close option from the system menu, then the close button will get disabled. See the MSDN entries for DeleteMenu()[^]
 
Share this answer
 
Comments
Bhavin Jagad 8-Sep-10 11:32am    
Thanks

I found a simpler way to do this.

write following in OninitDialog

ModifyStyle(WS_SYSMENU,0,0);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900