CopyImage


static Handle CopyImage(Handle Image,
                        unsigned Type,
                        int Width,
                        int Height,
                        unsigned Flags)

This function copies an image (bitmap, icon or cursor).

Parameters

Handle Image

The handle of the image to be copied.

unsigned Type

The type of image to be copied. This may be one of the following values.

ImageType::Bitmap 0 The image is a bitmap.
ImageType::Icon 1 The image is an icon.
ImageType::Cursor 2 The image is a cursor.

int Width

The width (in pixels) of the new image.

int Height

The height (in pixels) of the new image.

unsigned Flags

A combination of the following values:

ImageFlag::CopyDeleteOriginal The original image is deleted after creating the copy.
ImageFlag::CopyExact An exact copy of the image is created - ignoring the width and height parameters.
ImageFlag::LoadMonochrome A monochrome image is created.
ImageFlag::CopyFromResource An attempt is made to reload an icon or cursor resource from the original resource file (in preference to copying the current image). This is useful for creating a copy of a different size when the resource file contains multiple sizes of the resource. Without this flag, the original image is stretched to the new size. When this flag is set, the size in the resource file that most closely matches the requested size is used.

This option will succeed only if image was loaded via

with the flag ImageFlag::LoadShared.

Return

Handle

The handle of the new image.

Notes

When the resource is no longer required, it may be released by calling one of the following functions.

Bitmap DeleteObject
Cursor DestroyCursor
Icon DestroyIcon

While resources are released automatically when the process terminates, calling the appropriate destruction function releases memory.

Details

Name Space IPlusPlus::Windows
Class Win
Assembly IPlusPlus.WinPlus.dll