How to disable the system menu on the button and floating toolbar in the dialog box

Source: Internet
Author: User

1. There are two methods to close the button in the disallow dialog box.

The first method is implemented by using the number of ModiftMenu () Han:

CMenu * pMenu = this-> GetSystemMenu (FALSE );
PMenu-> ModifyMenu (SC _CLOSE, MF_BYCOMMAND | MF_GRAYED );

The second method is implemented using the EnableMenuItem () Han Number:

CMenu * pMenu = this-> GetSystemMenu (FALSE );
PMenu-> EnableMenuItem (SC _CLOSE, MF_BYCOMMAND | MF_GRAYED );

2. disable the system menu on the floating toolbar.

Create a CToolBar derived class CxxToolBar, and double-click the left button in the new class (CxxToolBar: OnLButtonDblClk (...)) and left-click (CxxToolBar: OnLButtonDown (...)) add the following code to the culvert:

If (IsFloating ())File: // jobThe device is floating
{
CWnd * pMiniFrame;
CWnd * pDockBar;

PDockBar = GetParent ();
PMiniFrame = pDockBar-> GetParent ();

File: // goIn addition to the System Menu
PMiniFrame-> ModifyStyle (WS_SYSMENU, NULL );

File: // heavyPaint Toolbar
PMiniFrame-> ShowWindow (SW_HIDE );
PMiniFrame-> ShowWindow (SW_SHOW );
}

3. Disable window maximization button

Remove the WS_MAXIMIZEBOX style display in the PreCreateWindow () Han number.

BOOL CxxFrameWnd: PreCreateWindow (CREATESTRUCT & cs)
{
Cs. style & = ~ WS_MAXIMIZEBOX;
Return CFrameWnd: PreCreateWindow (cs );
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.