Solved

CHtmlView prints Blanks page

Posted on 2001-09-12
4
394 Views
Last Modified: 2013-11-20
Hi All,
I am using CHtmlView for Loading the HTML page and printing it. But when I do it, initially a blank page is printed. Next time when the print command is triggered, the previously loaded HTML file is printed. I am using ExecWB(...) for printing.

I tried using OnDocumentComplete(), OnDownLoadComplete() etc but no luck. Can anyone tell me How to solve this probs?

Thangs
0
Comment
Question by:Thangs
  • 2
4 Comments
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6481847
use the printing mechanism that comes in MFC
0
 
LVL 9

Accepted Solution

by:
ShaunWilde earned 200 total points
ID: 6481895
if you look at CHtmlView - you see that it calls ExecWB but using a different interface eg it uses IOleCommandTarget rather than IWebBrowser2

void CHtmlView::OnFilePrint()
{
    // get the HTMLDocument

    if (m_pBrowserApp != NULL)
    {
         LPOLECOMMANDTARGET lpTarget = NULL;
         LPDISPATCH lpDisp = GetHtmlDocument();

         if (lpDisp != NULL)
         {
              // the control will handle all printing UI

              if (SUCCEEDED(lpDisp->QueryInterface(IID_IOleCommandTarget,
                        (LPVOID*) &lpTarget)))
              {
                   lpTarget->Exec(NULL, OLECMDID_PRINT, 0, NULL, NULL);
                   lpTarget->Release();
              }
              lpDisp->Release();
         }
    }
}

0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 9532237
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: ShaunWilde

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Roshan Davis
EE Cleanup Volunteer
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
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…

746 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