Click here to Skip to main content
15,885,214 members
Please Sign up or sign in to vote.
5.00/5 (1 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:

C++
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

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); 
 
Share this answer
 
Comments
Chopin2001 8-Jan-21 8:41am    
Thank.

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