Solved

how to get HDC from a CDC object in MFC

Posted on 1998-02-25
4
4,034 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 10 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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
Windows Drag & Drop Location 2 108
Folder Comparison 12 54
How to match SAS datasets by multiple key variables and then rename and create new variables? 2 98
List out all word 7 318
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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 …
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.

830 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