Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how to get HDC from a CDC object in MFC

Posted on 1998-02-25
4
Medium Priority
?
4,133 Views
Last Modified: 2013-11-20
how can I get the HDC from a CDC object. I know it is storing in
m_hDC, but how to get the HDC. help please. Thanks
0
Comment
Question by:eugeneng
  • 2
  • 2
4 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 30 total points
ID: 1316526
CDC dc;

...

HDC hdc = dc.GetSafeHdc();

or

HDC hdc = dc.m_hDC;

0
 

Author Comment

by:eugeneng
ID: 1316527
right i'm calling an outside library function that require HDC as a parameter. i think the code you gave me is correct, but when i call the function with hdc be the parameter, after complied, it give me unresolve external symbol. the outside function i called want a traditional window HDC but i gave MFC hdc, are they compatible.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1316528
The unresolve external symbol has nothing to do with HDC. There must be other problems. HDC is a handle of device context. Only given an HDC, you cannot tell whether it is from MFC or not.
0
 

Author Comment

by:eugeneng
ID: 1316529
thanks chensu

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

971 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