Partager via


GweBypassCoredllThunk_t::GetDCEx_I (Windows Embedded CE 6.0)

1/6/2010

This method retrieves a handle to a display device context for the client area of a specified window or for the entire screen. You can use the returned handle in subsequent graphics display interface (GDI) functions to draw in the device context.

GweBypassCoredllThunk_t::GetDCEx_I is an extension to the GweBypassCoredllThunk_t::GetDC_I method, which gives an application more control over how and whether or not clipping occurs in the client area.

Syntax

static HDC WINAPI GetDCEx_I(
  HWND hwndThis,
  HRGN hrgnClip,
  DWORD flags
);

Parameters

  • hwndThis
    [in] Handle to the window for which the device context is to be retrieved. If this value is NULL, GweBypassCoredllThunk_t::GetDCEx_I retrieves the device context for the entire screen.
  • hrgnClip
    [in] Handle to a region that specifies a clipping region that can be combined with the visible region of the device context.
  • flags
    [in] DWORD that specifies how the device context is created. The following table shows the possible values.

    Value Description

    DCX_WINDOW

    Returns a device context corresponding to the window rectangle rather than the client rectangle.

    DCX_CACHE

    Returns a device context from the cache, rather than the OWNDC or CLASSDC window. Essentially overrides CS_OWNDC and CS_CLASSDC.

    DCX_PARENTCLIP

    Uses the visible region of the parent window. The WS_CLIPCHILDREN and CS_PARENTDC style bits for the parent are ignored. The device context origin is set to the upper-left corner of the window identified by hWnd.

    DCX_CLIPSIBLINGS

    Excludes the visible regions of all sibling windows above the window identified by hWnd.

    DCX_CLIPCHILDREN

    Excludes the visible regions of all child windows below the window identified by hWnd.

    DCX_NORESETATTRS

    Does not reset the attributes of this device context to the default attributes when this device context is released.

    DCX_EXCLUDERGN

    The clipping region identified by hrgnClip is excluded from the visible region of the returned device context.

    DCX_INTERSECTRGN

    The clipping region identified by hrgnClip is intersected with the visible region of the returned device context.

    DCX_VALIDATE

    When specified with DCX_INTERSECTUPDATE, causes the device context to be completely validated. Using this function with both DCX_INTERSECTUPDATE and DCX_VALIDATE is identical to using the GweBypassCoredllThunk_t::BeginPaint_I method.

Return Value

The handle of the device context for the specified window indicates success. NULL indicates failure. An invalid value for the hWnd parameter causes the function to fail. To get extended error information, call GetLastError.

Remarks

This method is an internal version of the GetDCEx function.

The flags parameter supports the following values: DCX_WINDOW, DCX_CACHE, DCX_CLIPCHILDREN, DCX_CLIPSIBLINGS, DCX_EXCLUDERGN, DCX_INTERSECTRGN, DCX_EXCLUDEUPDATE, and DCX_INTERSECTUPDATE.

Unlike a device context returned by GweBypassCoredllThunk_t::GetDC_I, a device context returned by this method is not kept synchronized with its associated window. If the window moves or is resized, unexpected drawing results can occur. The chance of error is reduced if an application gets a device context, draws, and then releases that device context.

Unless the display device context belongs to a window class, the GweBypassCoredllThunk_t::ReleaseDC_I method must be called to release the device context after painting. Because only five common device contexts are available at any given time, failure to release a device context can prevent other applications from accessing a device context.

The function returns a device context belonging to the class for the window if CS_CLASSDC, CS_OWNDC or CS_PARENTDC was specified as a style in the WNDCLASS structure when the class was registered.

Requirements

Header gwebypasscoredllthunk.hpp
Windows Embedded CE Windows CE .NET 4.0 and later

See Also

Reference

GweBypassCoredllThunk_t
GetDCEx
GweBypassCoredllThunk_t::BeginPaint_I
GweBypassCoredllThunk_t::GetDC_I
GweBypassCoredllThunk_t::ReleaseDC_I
WNDCLASS