Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

IWebBrowser and Printing

Posted on 1997-03-25
1
Medium Priority
?
338 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 400 total points
ID: 1334216
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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

926 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