Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CHtmlView prints Blanks page

Posted on 2001-09-12
4
Medium Priority
?
428 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
[X]
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
  • 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 800 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
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…
Suggested Courses

721 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