Share via


CPaintDC::CPaintDC

Constructs a CPaintDC object, prepares the application window for painting, and stores the PAINTSTRUCT structure in the m_ps member variable.

explicit CPaintDC( 
   CWnd* pWnd  
);

Parameters

  • pWnd
    Points to the CWnd object to which the CPaintDC object belongs.

Remarks

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.

Example

// Get a dc for a CWnd pointer.
CPaintDC dc(pWnd);

// Get a dc for a HWND.
CPaintDC dc2(CWnd::FromHandle(hWnd));

Requirements

Header: afxwin.h

See Also

Reference

CPaintDC Class

Hierarchy Chart