Solved

CHtmlView prints Blanks page

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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 is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

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