IE4 Style Menu (Rebar Menu) '
Download Source Code and Example 72KB
In Internet Explorer 4.0 Microsoft made some cool looking menu. When I use Spy ++ it shows that this is just toolbar inside rebar. I made some searches but I didn't found anything like that on codeguru sites.
So I made it myself.
I used Luis Barreira Classes for new IE4 controls to get CRebar.
There are two main points of this solution:
First is creating buttons based on menu resource IDR_MAINFRAME, this fragment is from CMainFrame OnCreate:
//create toolbar buttons based on menu (IDR_MAINFRAME) TBBUTTON button; CString strItem; CMenu mTopMenu; mTopMenu.LoadMenu(IDR_MAINFRAME); UINT iPos; for (iPos = 0; iPos
Then handler for buttons, this handler is called by macro ON_COMMAND_RANGE, ClassWizard did not support this so you must take it from my example or read some in MSDN.
// handler to menu buttons
void CMainFrame::OnMenu(UINT nID)
{
CMenu m_mnuTopMenu;
CRect rWindow,rButton;
m_mnuTopMenu.LoadMenu(IDR_MAINFRAME);
UINT iPos;
for (iPos = 0; iPos TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,rWindow.left,rWindow.top,this);
m_wndMenuBar.GetToolBarCtrl().SetState(iPos+1,TBSTATE_ENABLED);
break;
}
}
}
That's it.
In this moment this solution don't support accelerators to button.
Last updated: 16 July 1998

Comments
Wow
Posted by Legacy on 06/12/2003 12:00amOriginally posted by: Janusz Jasinski
Wow
ReplyComments
Posted by Legacy on 03/11/2003 12:00amOriginally posted by: Jerry
Superb....
ReplyI like it very much
Posted by Legacy on 03/26/2002 12:00amOriginally posted by: xblackbox
I like it very much
ReplyThe code never compiles
Posted by Legacy on 11/20/2001 12:00amOriginally posted by: Ankur Sharma
Dear author,
please check why the code is not compiling. It is not able to find afximpl.h file. I guess there are some project setting problems.
thanks
Replyankur
this code does not compile
Posted by Legacy on 03/20/2001 12:00amOriginally posted by: Yuri Bloshtein
This code does not compile. Please make it working. Is your CReBar class the same as Microsoft has?
Replywithout hottracking... this Rebar-Toolbar is useless...
Posted by Legacy on 02/07/2001 12:00amOriginally posted by: Trong Ha
The use of hooking window message in a MSDN article is applicable. The main point is you need to really understand how window hooking messages work. There has some other methodologies to make the Menu-Hottracking happen in this scenario. Once, you can spy on the toolbar when the menupopu up... then use window hook so the toolbar can hear all messages so you can handle HotItemchange.
ReplyWe did make this toolbar work exactly like IE and it aslo has the Outlook style too.. it means you have to handle the OwnerDraw menuitem. However, this version is just for sale and I can't talk about the way how to do it... but I just want to validate the this thing can be done by someway... not just the way that MSDN has described.
Hot-Tracking ??
Posted by Legacy on 12/14/2000 12:00amOriginally posted by: John Langley
Okay, I've got my own example not using MFC, and it works as far as this one does, all the menus pop up correctly, the actions get fired successfully, etc. My problem is I'm trying to implement hot-tracking on these menus so that when the user has a menu selected (like 'File'), and then, without clicking, hovers over another menu item (like 'Edit'), the menu is switched from displaying the old menu items to displaying the new menu items in the correct position. *OR*, a person could use the left or right arrow keys to navigate this as well. The MSDN provides an explanation briefly of what must happen, and I understand it but I just haven't gotten it to work without crashing in my face! It involves setting up a Windows hook procedure prior to the call to TrackPopupMenu, then uninstalling that hook after use. Of course, the MSDN doesn't provide a sample on this.. Is this something someone else has been able to do? I'd greatly appreciate any help!
Thanks,
Reply-John
Disappointed - Does not compile
Posted by Legacy on 11/30/2000 12:00amOriginally posted by: Bill Roach
It is a poor reflection on the author's skills when the code won't even compile. I am running Version 6 SP4. There should be no reason for this code to not compile.
ReplyWhy loop in OnMenu()?????
Posted by Legacy on 08/02/2000 12:00amOriginally posted by: Jeong, Sung-won
Reply