class CWindowDC : public CDC
Protected Data Members
|CWindowDC::m_hWnd||The HWND to which this
Calls the Windows function GetWindowDCat construction time and ReleaseDC at destruction time. This means that a
CWindowDC object accesses the entire screen area of a CWnd (both client and nonclient areas).
For more information on using
CWindowDC, see Device Contexts.
CWindowDC object that accesses the entire screen area (both client and nonclient) of the
CWnd object pointed to by pWnd.
explicit CWindowDC(CWnd* pWnd);
The window whose client area the device-context object will access.
The constructor calls the Windows function GetWindowDC.
An exception (of type
CResourceException) is thrown if the Windows
GetWindowDC 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.
// Get a dc for a CWnd object pointer. CWindowDC dc(pWnd); // Send my private massage. ::SendMessage(pWnd->m_hWnd, WM_MYMESSAGE, 0, 0);
The HWND of the
CWnd pointer is used to construct the
m_hWnd is a protected variable of type HWND.
See the example for CWindowDC::CWindowDC.