| description | Learn more about: CClientDC Class | ||||
|---|---|---|---|---|---|
| title | CClientDC Class | ||||
| ms.date | 11/04/2016 | ||||
| f1_keywords |
|
||||
| helpviewer_keywords |
|
||||
| ms.assetid | 8a871d6b-06f8-496e-9fa3-9a5780848369 |
Takes care of calling the Windows functions GetDC at construction time and ReleaseDC at destruction time.
class CClientDC : public CDC
| Name | Description |
|---|---|
| CClientDC::CClientDC | Constructs a CClientDC object connected to the CWnd. |
| Name | Description |
|---|---|
| CClientDC::m_hWnd | The HWND of the window for which this CClientDC is valid. |
This means that the device context associated with a CClientDC object is the client area of a window.
For more information on CClientDC, see Device Contexts.
CClientDC
Header: afxwin.h
Constructs a CClientDC object that accesses the client area of the CWnd pointed to by pWnd.
explicit CClientDC(CWnd* pWnd);
pWnd
The window whose client area the device context object will access.
The constructor calls the Windows function GetDC.
An exception (of type CResourceException) is thrown if the Windows GetDC call fails. A device context may not be available if Windows has already allocated all of its available device contexts. Your application competes for the five common display contexts available at any given time under Windows.
[!code-cppNVC_MFCDocView#42]
The HWND of the CWnd pointer used to construct the CClientDC object.
HWND m_hWnd;
m_hWnd is a protected variable.
See the example for CClientDC::CClientDC.