How Do I Disable Close Window X?
I have a CToolBar which when dragged from its docking position, becomes a window.
It displayes that little cross 'fella' in the corner to close it.
I want to disable this. I had assumed that I could create it without one but I dont know how. I notice in Visual studio the toolbar close facilty (X) is disable How do I do that?
Re: How Do I Disable Close Window X?
Try following.
First, get system menu from floating window,
then disable close button.
Here is a tiny code and they work for all windows with system menu.
CMenu *pSysMenu = (CMenu*)pMiniFrame->GetSystemMenu(FALSE);
pSysMenu->DeleteMenu(SC_CLOSE, MF_BYCOMMAND);
Good Luck. :)
Walter I An
Re: How Do I Disable Close Window X?
CMenu *pSysMenu = (CMenu*) (&m_wndToolBar2)->GetSystemMenu(FALSE);
pSysMenu->DeleteMenu(SC_CLOSE, MF_BYCOMMAND);
This creates an exception. Probably because the window is not originally created as floating. So it doesnot have a system menu. How do I only call this once the window floats?
In otherwords what message can I capture that tells me when the window is made to float.
Simon Pettman
Re: How Do I Disable Close Window X?
Hi
You can see the answer at CodeGuru Home Page.
In Home Page, there is title "Other Source Code Section". Select "dialog". And then search the title "Menu Handling". Under "Menu Handling" there is a subject "Disable close button for Dialog Box" by Rajesh Rarikh. You can study and enjoy.
AntHtoo Naing
Re: How Do I Disable Close Window X?
U are right!
U need to check this when Ur window is not docked.
There is a function called "IsFloating()"
in CControlBar.
Good luck. :)
Walter An