Click here to Skip to main content
15,885,032 members
Articles / Programming Languages / C++

IE Drop-Down Button

Rate me:
Please Sign up or sign in to vote.
1.85/5 (8 votes)
8 Nov 20073 min read 36.8K   304   16  
similar skype IE toolbar button, with drop-down arraw, support IE6 & IE7(multi-tab)
#ifndef TOOLBARPARENTWND_H_INCLUDED
#define TOOLBARPARENTWND_H_INCLUDED

#pragma once
#include <shobjidl.h>
#include<atlwin.h>


#define BUTTON_NAME TEXT("Dropdown Arrow Button")   
#define WM_NOTIFY_SETBUTTONINFO WM_USER+1012 

// �������ݴ�����Ϣ�ṹ
typedef struct tagBrowserWndInfo
{
	IWebBrowser2 *pWebBrowser; // �����ָ��
	int nButtonState;  //��ǰ���ڵİ�ť״̬
	HWND hBrowserWnd;  //��ʾ���ݵ����������
} BrowserWndInfo;

class CToolBarParentWnd : public CWindowImpl<CToolBarParentWnd>
{
public:
    CToolBarParentWnd(void);

public:
    ~CToolBarParentWnd(void);

BEGIN_MSG_MAP(CToolBarParentWnd)
    MESSAGE_HANDLER(WM_COMMAND, OnCommand)
    NOTIFY_CODE_HANDLER(TBN_DROPDOWN, OnNotifyDropDown)
    MESSAGE_HANDLER(WM_NOTIFY_SETBUTTONINFO, OnNotifySetButtonInfo)
END_MSG_MAP()

public:
    LRESULT OnNotifySetButtonInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/);
	LRESULT OnNotifyDropDown(WPARAM wParam, LPNMHDR lpnmhdr, BOOL& /*bHandled*/); 

    LRESULT OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& /*bHandled*/);

	void SetBrowserWndInfo(BrowserWndInfo *pBrowserWndInfo);
	BrowserWndInfo *GetBrowserWndInfo();

public:
    void SetToolbarWnd(HWND hToolbarWnd);
    void SetButtonID(int nID);
    int GetButtonID();
    void NotifySetButtonInfo(int buttonID);
    void OnDropDown(LPNMTOOLBAR lpnmtb);
private:
    void SetButtonCheck(BOOL bChecked);
    void LoadMenu();
    void ReleaseMenu();

private:
    HMENU m_hMenu;
    HMENU m_hMemuTrackPopup;
    HWND m_ToolbarWnd;
    int  m_nButtonID;
    int  m_nButtonState;

	BrowserWndInfo *m_pBrowserWndInfo;
};

#endif // #ifndef TOOLBARPARENTWND_H_INCLUDED

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions