Share via


Gdi::CreateCompatibleDC_I (Windows Embedded CE 6.0)

1/6/2010

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

Syntax

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 Value

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

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

See Also

Reference

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