Solved

how to get HDC from a CDC object in MFC

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 36
maxBlock challenge 30 130
string initialization in java 11 113
Problem to open Excel file 15 136
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: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

803 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