Share via


Printing Pages with the WebBrowser Control (Windows CE 5.0)

Send Feedback

Although the WebBrowser control does not support a print method, you can print its contents by using one of the following methods:

  • Set the focus to the WebBrowser control and send a key combination of CTRL+P.

  • Call the IWebBrowser2::get_Document method, as shown in this example.

    LPDISPATCH lpDispatch = NULL;
    LPOLECOMMANDTARGET lpOleCommandTarget = NULL;
    lpDispatch = m_pBrowser.get_Document();
    ASSERT(lpDispatch);
    lpDispatch->QueryInterface(IID_IOleCommandTarget, (void**)&lpOleCommandTarget);
    ASSERT(lpOleCommandTarget);
    lpDispatch->Release();
    // Print contents of WebBrowser control.
    lpOleCommandTarget->Exec(NULL, OLECMDID_PRINT, 0, NULL,NULL);
    lpOleCommandTarget->Release();
    

See Also

Internet Explorer Browser Control Host Application Development

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.