Copy a DC to another DC

Posted on 1998-12-23
Last Modified: 2013-11-20
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.
Question by:traott
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
  • 3
  • 3

Expert Comment

ID: 1326634
BitBlt with the SRCCOPY operation

Author Comment

ID: 1326635
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.

Expert Comment

ID: 1326636
Could you create a new pointer to the original DC?  Or do you need a completely separate DC?
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 1326637
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.

Expert Comment

ID: 1326638
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.

Author Comment

ID: 1326639
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

Accepted Solution

Answers2000 earned 100 total points
ID: 1326640
Thanks traott

Merry Xmas

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

688 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