Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


Returns a pointer to a CDC object when given a handle to a device context.

static CDC* PASCAL FromHandle(
   HDC hDC 



Contains a handle to a Windows device context.

The pointer may be temporary and should not be stored beyond immediate use.

If a CDC object is not attached to the handle, a temporary CDC object is created and attached.

See the example for CPrintDialog::GetPrinterDC.

Community Additions

© 2015 Microsoft