Drop-down buttons on Toolbar Control in IE Add-in 
Author Message
 Drop-down buttons on Toolbar Control in IE Add-in

Here's the code I have for the toolbar class which is where the toolbar is
created, and the button added.

I would like to add a drop-down menu button, and understand that it uses a
different parameter to create it. However, could someone give me a quick
explanation of how I add the items to the submenu that should appear, and
then how I intercept messages that come from that menu. I'm new to ATL (and
VC++ without MFC in general :).

I've found an article on MSDN at
tform/CommCtls/ToolBar/Styles.asp that explains the different styles, and
includes an example of how to hook in drop-down support, although I'm a
little confused as to how to actually implement the same code in the IE

Thank you for any help you can offer,

LRESULT CToolbar::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL&
 // buttons with images and text
 SendMessage(m_hWnd, TB_SETEXTENDEDSTYLE, 0,
 // Sets the size of the TBBUTTON structure.
 SendMessage(m_hWnd, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
 // Set the maximum number of text rows and bitmap size.
 SendMessage(m_hWnd, TB_SETMAXTEXTROWS, 1, 0L);

 // add our button's caption to the toolbar window
 TCHAR* pCaption = _T("Get Quote");
 int iIndex = ::SendMessage(m_hWnd, TB_ADDSTRING, 0,(LPARAM)pCaption);

 // load our button's icon and create the image list to house it.
 HICON hMotley = LoadIcon(_Module.GetResourceInstance(),
 m_hImageList = ImageList_Create(16,16, ILC_COLOR16, 1, 0);
 int iImageIndex = ImageList_AddIcon(m_hImageList, hMotley);
 // Set the toolbar's image
 ::SendMessage(m_hWnd, TB_SETIMAGELIST, 0, (LPARAM)m_hImageList);

 // add the button for the toolbar to the window
 ZeroMemory((void*)&Button, sizeof(TBBUTTON));
 Button.idCommand = IDM_GETQUOTE;
 Button.fsState = TBSTATE_ENABLED;
 Button.dwData = 0;
 Button.iString = iIndex;
 Button.iBitmap = 0;
 ::SendMessage(m_hWnd, TB_INSERTBUTTON, 0, (LPARAM)&Button);

 // create our EditQuote window and set the font.
 RECT rect = {0,0,0,0};
 m_EditWnd.Create(m_hWnd, rect, NULL, WS_CHILD|WS_VISIBLE,
 return 0;


Tue, 12 Oct 2004 07:21:39 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Adding a drop down button to toolbar

2. Toolbar drop-down menu problem trying to display popup menu (IE Deskbar)

3. how to Add a button to IE Toolbar?

4. How to add a button in IE toolbar?

5. add toolbar button to IE's menu bar

6. Toolbar drop down menu doesn't show properly

7. q: toolbar drop down combo box and document data

8. Drop-down toolbar

9. Drop-down box on Toolbar?

10. toolbars + drop down lists

11. Drop-down box on Toolbar?

12. Help, Drop down button errors out


Powered by phpBB® Forum Software