Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

IWebBrowser and Printing

Posted on 1997-03-25
1
322 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…

856 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