Printing Pages with the WebBrowser Control (Windows Embedded CE 6.0)
1/6/2010
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
Other Resources
Internet Explorer Browser Control Host Application Development