Solved

how to get HDC from a CDC object in MFC

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now