Link to home
Start Free TrialLog in
Avatar of traott
traottFlag for United States of America

asked on

Copy a DC to another DC

Is there a way to copy one Device Context(DC) to another?  The application I am working on is using an old graphics package and does not have a way to print the graphics.  I thought if I can copy the DC from the graphics window to a printer DC I could solve this problem.
Avatar of Answers2000
Answers2000

BitBlt with the SRCCOPY operation
Avatar of traott

ASKER

Doesn't BitBlt only copy bitmaps to DC.  From what I read it will only copy the raster and not the vector part.  I need both.  I am misunderstanding the use of BitBlt.
Could you create a new pointer to the original DC?  Or do you need a completely separate DC?
Avatar of traott

ASKER

I believe I need a completely seperate DC, because to print, you have to create a Printer Device Context instead of a screen Device Context.  This way I can send the Printer DC to the Draw function of the Graphics package with basically the same info except I am sending it to the printer instead of the screen.
The DC represents the interface to a drawing surface

It doesn't actually store anything (except status stuff like what pen color, etc)

The data on the DC is rendered...and for Windows video drivers...will always be rendered as a bitmap - i.e. there is no vector data associated with the content of the screen - as soon as you draw something (e.g. a line) the video driver converts it to a bitmap.

So BitBlt is the way..

BTW the only except to the rendering rule is meta-files which do actually (kind of) store vectors.  But this doesn't apply in your case, as you are working with a screen image.
Avatar of traott

ASKER

Thanks for the clarification on what is actually drawn on the screen, this will help.  I will give Answers2000 the points if you add in the answer
ASKER CERTIFIED SOLUTION
Avatar of Answers2000
Answers2000

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial