?
Solved

Render a CHtmlView to a memory device context?

Posted on 2003-03-12
7
Medium Priority
?
722 Views
Last Modified: 2013-11-20
Hello,

I have 2 questions:
1)  how would I go about to render a CHtmlView to a memory device context?
    what member functions would I have to overload?
    (Just BitBlt-ing to a memory device context won't be enough.
    I need to actually render to such a DC instead of to the screen.

2)  When I use OnPaint then whatever I paint is drawn BEFORE I see the
    webpage that CHtmlView.  So for example I see my painted stuff flicker
    up for a very brief time and then it gets overwritten by the webpage.
    How would I go about to paint something ON TOP of the webpage?

Thank you for your answers!
Reinhard
0
Comment
Question by:rhoepperger
[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
7 Comments
 
LVL 12

Accepted Solution

by:
williamcampbell earned 200 total points
ID: 8123588
1)
In For Instance OnPaint
     // Memory DC compatible your window
        CDC cdcMem;
      cdcMem.Attach ( OnPaintsDC )

     // Get the raw screen coords of the window
        CRect rect;
     GetWindowRect  ( rect );

        // Create the bitmap compatible
     HBITMAP hBmp = NULL;
     HDC hdc = ::GetDC ( pDC );
     CDC* pDC = new CDC;
     pDC->Attach ( hdc );
    hBmp = CreateCompatibleBitmap ( pDC->GetSafeHdc (), rect.right - rect.left, rect.bottom - rect.top );

    // Move memory area into the bitmap
    HGDIOBJ hOld = cdcMem.SelectObject ( hBmp );
     cdcMem.BitBlt( 0, 0, rect.right - rect.left, rect.bottom - rect.top, pDC, rect.left,rect.top, SRCCOPY );

     // done dc
        ReleaseDC ( pDC );

     // clean up
     cdcMem.SelectObject ( hOld );
        cdcMem.Detach ();

     delete pDC;
2)
You are calling the default ::OnPaint () too soon
Call OnPaint First then do your drawing
Alternatively do you painting in OnEraseBackground and retyrn TRUE from OnEraseBackGround
0
 

Author Comment

by:rhoepperger
ID: 8123718
williamcampbell, thanks a lot for your help.  I will try your suggestions tonight or first thing tomorrow morning.

Thanks a lot!
Reinhard
0
 

Expert Comment

by:rhopperger
ID: 11628054
I would like to accept williamcampbell's answer (and thank you for it!) but don't see the buttons "Accept answer"...
Could you please accept the answer for me Dan?  Thank you.

Thanks WilliamCampbell!

Reinhard

0
 

Expert Comment

by:rhopperger
ID: 11800677
Hi Dan,

My name in Austria is Höpperger which in English can be represented as hoepperger or hopperger.  As experts-exchange did not allow umlauts, I used rhoepperger while I was still living in Europe.  I moved to America 4 years ago and here my name is Hopperger and so I used rhopperger as my username.   That's probably how this two account-scenario happened.

Anyway,  I CAN log on as rhopperger (the newer account) but no matter what I try, I CANNOT log on as rhoepperger.  I get a weird error page (SQL errors and such...) if I try.

So I have no means of loging on as rhoepperger and also cannot give anybody the points for the answer.
As I cannot log onto the site as rhoepperger anyway, there will also be no more problem in the future.  The few questions that are still open as rhoepperger will be closed soon and every new question will be under rhopperger.

I accept williamcampbell as the guy who gets the points.  Thanks William!  And sorry for not closing the question earlier.

And thank you to all, who spent time answering the question.

Kind regards
Rhopperger
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

765 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