Click here to Skip to main content
14,325,129 members
Rate this:
Please Sign up or sign in to vote.
See more:
I don't know how to remove menubar from dialog that inherit CDockablePane, create by CreateEx function in mainframe of MDI(MFC).
My Dialog's problem is have a menubar that have a 'X' icon for close. I want to remove that.
Thanks.

What I have tried:

m_wndOptionBar.CreateEx(NULL, NULL, this, CRect(0, 0, 1250, 50),
    true, 1239,
    WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS |
    WS_CLIPCHILDREN | CBRS_TOP | CBRS_FLOAT_MULTI);
m_wndOptionBar.EnableDocking(CBRS_ALIGN_TOP);
DockPane(&m_wndOptionBar);
Posted
Updated 23-Jan-19 12:11pm
Comments
Richard MacCutchan 27-Apr-18 3:42am
   
What class type is m_wndOptionBar.
Richard MacCutchan 27-Apr-18 3:50am
   
What type of class is m_wndOptionBar

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

If you go over all Windows styles[^], and Extended Windows Styles[^], you should find the answer.

Also you can remove the close button using the following code (assuming you get a handle to hwnd):

HMENU hMenu = GetSystemMenu( hWnd, 0 ); 
int nNbItems = GetMenuItemCount(hMenu); 
m_wndOptionBar.RemoveMenu(hMenu, nNbItems - 1, MF_BYPOSITION); 
m_wndOptionBar.RemoveMenu(hMenu, nNbItems - 2, MF_BYPOSITION); 
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100