Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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