Click here to Skip to main content
15,914,594 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Single application instance Pin
Vu Nguyen7-Dec-01 14:43
Vu Nguyen7-Dec-01 14:43 
GeneralRe: Single application instance Pin
Vu Nguyen10-Dec-01 10:29
Vu Nguyen10-Dec-01 10:29 
GeneralRe: Single application instance Pin
Joe Moldovan8-Jul-01 10:15
Joe Moldovan8-Jul-01 10:15 
GeneralRe: Single application instance Pin
8-Jul-01 13:21
suss8-Jul-01 13:21 
GeneralRe: Single application instance Pin
8-Jul-01 13:25
suss8-Jul-01 13:25 
GeneralRe: Single application instance Pin
9-Jul-01 3:56
suss9-Jul-01 3:56 
GeneralRe: Single application instance Pin
Bret Faller9-Jul-01 11:27
Bret Faller9-Jul-01 11:27 
QuestionHow to create a menu bar in ATL control Pin
Oliver Daniel7-Jul-01 8:59
Oliver Daniel7-Jul-01 8:59 
I'm working on an ATL based control with addition of WTL to support a GUI that will operate within the control's client area. The problem I'm having is getting a regular menu bar to operate within the control. Since ActiveX controls can't support a menu bar, I thought I could use a command bar to contain the menu.

WTL provides a CCommandBarCtrl class that seems to handle this very nicely but the resulting menu bar doesn't handle mouse clicks correctly. Basically the menu bar shows up and each menu highlights as I mouse over them, but they do not respond to mouse clicks. Additonally if I use a keyboard shortcut to select the menu, the application freezes with the menu left flashing. Using Spy++, I can see a continuous flood of WM_NOTIFY messages during the freeze.

I have the command bar operating as a child of a CFrameWindowImpl class which is a child of the control's window. It also integrates with several toolbars within a rebar control. Here's how I create the command bar and setup the menu:


m_CmdBar.Create(m_hWnd, rcDefault, NULL, ATL_SIMPLE_CMDBAR_PANE_STYLE, 0, ATL_IDW_COMMAND_BAR);

m_CmdBar.AttachMenu(LoadMenu(_Module.m_hInst, MAKEINTRESOURCE(IDR_MAINFRAME)));

m_CmdBar.LoadImages(IDR_TBARMAIN);

CreateSimpleReBar(ATL_SIMPLE_REBAR_STYLE);

AddSimpleReBarBand(m_CmdBar, NULL, TRUE);

I believe this works fine in a regular application where the command bar is a child of CMainFrame, but it behaves strangely in my control.

Any help would be appreciated.

- Oliver

AnswerRe: How to create a menu bar in ATL control Pin
7-Jul-01 10:10
suss7-Jul-01 10:10 
GeneralRe: How to create a menu bar in ATL control Pin
Oliver Daniel8-Jul-01 3:01
Oliver Daniel8-Jul-01 3:01 
Generalfile opening Pin
7-Jul-01 7:15
suss7-Jul-01 7:15 
GeneralRe: file opening Pin
7-Jul-01 9:33
suss7-Jul-01 9:33 
GeneralRe: file opening Pin
7-Jul-01 21:32
suss7-Jul-01 21:32 
GeneralRe: file opening Pin
Michael Dunn7-Jul-01 19:54
sitebuilderMichael Dunn7-Jul-01 19:54 
GeneralRe: file opening Pin
8-Jul-01 10:35
suss8-Jul-01 10:35 
GeneralDeskTop Icon Pin
Muhammad Nauman Khan7-Jul-01 6:52
Muhammad Nauman Khan7-Jul-01 6:52 
GeneralDeskTop Icon Pin
Muhammad Nauman Khan7-Jul-01 6:52
Muhammad Nauman Khan7-Jul-01 6:52 
GeneralMenu in MDI Child Pin
Simon Brown7-Jul-01 6:14
Simon Brown7-Jul-01 6:14 
GeneralDialog Resizing Pin
7-Jul-01 4:23
suss7-Jul-01 4:23 
GeneralRe: Dialog Resizing Pin
User 110607-Jul-01 5:05
User 110607-Jul-01 5:05 
GeneralRe: Dialog Resizing Pin
7-Jul-01 9:35
suss7-Jul-01 9:35 
GeneralRe: Dialog Resizing Pin
Christian Graus8-Jul-01 2:27
protectorChristian Graus8-Jul-01 2:27 
GeneralAttaching variables to a control Pin
6-Jul-01 13:16
suss6-Jul-01 13:16 
GeneralRe: Attaching variables to a control Pin
6-Jul-01 15:00
suss6-Jul-01 15:00 
GeneralRe: Attaching variables to a control Pin
6-Jul-01 15:30
suss6-Jul-01 15:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.