How to disable the dialog closing the system menu on the button and floating toolbar
Author: Xu Jing Zhou
1. There are two ways to close the button in the disable dialog.
l The first method, implements the MODIFTMENU () to achieve:
CMenu * pmenu = this-> getSystemMenu (false);
Pmenu-> ModifyMenu (sc_close, mf_bycommand | mf_grayed);
l The second method is implemented with EnableMenuItem ().
CMenu * pmenu = this-> getSystemMenu (false);
PMenu-> EnableMenuItem (sc_close, mf_bycommand | mf_grayed);
2. Prohibit the system menu on the floating tool bar.
l Newly built a ctoolbar derived CXXToolbar, the left button in the new class Double-click (CXXToolbar :: ONLBUTTONDBLCLK (...)) and left click (CXXToolbar :: OnlButtondown (...)) The following Code can:
IF (isfloating ()) // Toolbar is floating in a state
{
CWND * PMINIFRAME;
CWND * pdockbar;
PDOCKBAR = getParent ();
Pminiframe = pdockbar-> getParent ();
// Remove it on the system menu
PminiFrame-> ModifyStyle (ws_sysmenu, null);
// Redraw the toolbar
PminiFrame-> showwindow (SW_HIDE);
PminiFrame-> showwindow (SW_SHOW);
}
3, prohibiting the window to maximize the button
l Remove the WS_Maximizebox style in PrecreateWindow ().
Bool CXXFrameWnd :: PrecreateWindow (CreateStruct & Cs)
{
CS.Style & = ~ ws_maximizebox;
Return CFrameWnd :: PrecreateWindow (CS);
}
Contact information:
Author email: jingzhou_xu@163.com
Future Studio (Future Studio)