CWnd::GetDCEx 

CDC* GetDCEx( CRgn* prgnClip, DWORD flags );

Return Value

The device context for the specified window if the function is successful; otherwise NULL.

Parameters

prgnClip

Identifies a clipping region that may be combined with the visible region of the client window.

flags

Can have one of the following preset values:

Remarks

Retrieves the handle of a device context for the CWnd window. The device context can be used in subsequent GDI functions to draw in the client area.

This function, which is an extension to the GetDC function, gives an application more control over how and whether a device context for a window is clipped.

Unless the device context belongs to a window class, the ReleaseDC function must be called to release the context after drawing. Since only five common device contexts are available at any given time, failure to release a device context can prevent other applications from gaining access to a device context.

In order to obtain a cached device context, an application must specify DCX_CACHE. If DCX_CACHE is not specified and the window is neither CS_OWNDC nor CS_CLASSDC, this function returns NULL.

A device context with special characteristics is returned by the GetDCEx function if the CS_CLASSDC, CS_OWNDC, or CS_PARENTDC style was specified in the WNDCLASS structure when the class was registered.

For more information about these characteristics, see the description of the WNDCLASS structure in the Win32 SDK documentation.

CWnd OverviewClass MembersHierarchy Chart

See Also   CWnd::BeginPaint, CWnd::GetDC, CWnd::GetWindowDC, CWnd::ReleaseDC, ::GetDCEx