Solved

CHtmlView prints Blanks page

Posted on 2001-09-12
4
405 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 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 98
maxBlock challenge 30 146
lucky13 challenge 11 158
fix34  challenge 9 166
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 …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.

749 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