Share via


Gdi::CreateCompatibleDC_I (Windows CE 5.0)

Send Feedback

This method creates a memory device context compatible with the specified device.

static WINGDIAPI HDC WINAPI CreateCompatibleDC_I(HDC hdcIn);

Parameters

  • hdcIn
    [in] Handle to an existing device context.

    If this handle is NULL, the method creates a memory device context compatible with the current screen for the application.

Return Values

The handle to a memory device context indicates success.

NULL indicates failure.

To get extended error information, call GetLastError.

Remarks

This method is an internal version of the CreateCompatibleDC function.

A memory device context is a device context that exists only in memory. When you create the memory device context, its display surface is exactly one monochrome pixel wide and one monochrome pixel high.

Before an application can use a memory device context for drawing operations, the application must select a bitmap of the correct width and height into the device context.

The application can select a bitmap of the correct size into the device context by using the Gdi::CreateCompatibleBitmap_I method and specifying the height, width, and color organization required in the method call.

When you create a memory device context, all its attributes are set to normal default values. You can use the memory device context as a normal device context. You can set the attributes to non-default values, obtain the current setting of the attributes, and select pens, brushes and regions into the device context.

You can only use the Gdi::CreateCompatibleDC_I method with devices that support raster operations. An application can determine whether a device supports these operations by calling the Gdi::GetDeviceCaps_I method.

When you no longer need the memory device context, call the Gdi::DeleteDC_I method to delete the memory device context.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Gdi.hpp.

See Also

Gdi | CreateCompatibleDC | Gdi::CreateCompatibleBitmap_I | Gdi::DeleteDC_I | Gdi::GetDeviceCaps_I

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.