Solved

CHtmlView prints Blanks page

Posted on 2001-09-12
4
396 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

867 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

15 Experts available now in Live!

Get 1:1 Help Now