Adding a button to IE toobar

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

Hello All,

I am trying to add a button to a custom IE toolbar that will print the
currently displayed website. (Before a get a bunch of posts... I know
this can be done by using File => Print).

Using a number of different examples, I have a custom with a button
that displays a message box when the user clicks on. I have been
struggling with this for a few days and desperately seeking help.

This is what I have so far:

on the SetSite() function I create the toolbar with code below:
{
RECT _rcClientParent;

m_rebar.GetClientRect(&_rcClientParent);

// We need to create an Invisible Child Window using the Parent
Window, this will also be used to reflect Command
// messages from the rebar
m_parent.Create(m_rebar, _rcClientParent, NULL, WS_CHILD);

// Now we can create the Tool Bar, using the Invisible Child
m_toolbar.m_hWnd = m_toolbar.CreateSimpleToolBarCtrl(m_parent,
IDR_TOOLBAR, FALSE, ATL_SIMPLE_TOOLBAR_PANE_STYLE);
m_toolbar.SetExtendedStyle(TBSTYLE_EX_DRAWDDARROWS |
TBSTYLE_EX_MIXEDBUTTONS);
}


//Get and keep the IInputObjectSite pointer.
m_pSite = _pSite;
//Here I pass the pointer of the IE window to the class that contains
//the button functionality
m_parent.get_ie_handle ( m_pSite );


//this is a code snippet from the CParent class.
//Here have access to the handle to the IE window by retrieving the
*_m_pSite pointer
IInputObjectSite *_m_pSite;

LRESULT OnButtonDollar(WORD /*wNotifyCode*/, WORD /*wID*/, HWND
/*hWndCtl*/, BOOL& /*bHandled*/)
{
::MessageBoxA(NULL, "CToolbar::OnButtonDollar", __TIME__, MB_OK);
//I want to print the current page
return 0;
}

void get_ie_handle(IInputObjectSite *m_pSite)
{
*_m_pSite = *m_pSite;
}

Hopefully this is clear?


Thanks Again
Frank

(e-mail address removed)
remove the -- and -- to email
 
Back
Top