Solved

IWebBrowser and Printing

Posted on 1997-03-25
1
308 Views
Last Modified: 2013-12-03
Assuming I have managed to embed a WebBrowser control from the ActiveX SDK client window that I have created, how can I instruct it to print its content?
0
Comment
Question by:xen15
1 Comment
 
LVL 2

Accepted Solution

by:
kolarb earned 200 total points
Comment Utility
How do I print from the WebBrowser control?Although the WebBrowser control does
not support a print method, you can print its contents using one of two ways:
•Set focus to the Web Browser Control and send a key combination of Ctrl-P, or
•Call the GetDocument() method, which returns an *IDispatch. Using thisIDispatch

pointer, call QueryInterface() on IID_IOleCommandTarget. With the object pointer

returned, call Exec (NULL, OLECMDID_PRINT, 0, NULL,NULL):     LPDISPATCH
lpDispatch = NULL;    LPOLECOMMANDTARGET lpOleCommandTarget = NULL;    
lpDispatch = m_ctlWebBrowser.GetDocument();    ASSERT(lpDispatch);    
lpDispatch->QueryInterface(IID_IOleCommandTarget,(void**)&lpOleCommandTarget);  

 ASSERT(lpOleCommandTarget);    lpDispatch->Release();    // print contents of
web browser control    lpOleCommandTarget->Exec(NULL, OLECMDID_PRINT, 0,
NULL,NULL);    lpOleCommandTarget->Release();
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now