# Function Reference

# _WinAPI_CopyImage

Creates a new image (icon, cursor, or bitmap) and copies the attributes of the specified image to the new one

#include <WinAPIGdi.au3>
_WinAPI_CopyImage ( $hImage [, $iType = 0 [, $iXDesiredPixels = 0 [, $iYDesiredPixels = 0 [, $iFlags = $LR_DEFAULTCOLOR]]]] )

## Parameters

$hImage | Handle to the image to be copied.
$iType | [optional] Specifies the type of image to be copied. This parameter can be one of the following values: $IMAGE_BITMAP 'Default) $IMAGE_CURSOR $IMAGE_ICON
$iXDesiredPixels | [optional] Specifies the desired width, in pixels, of the image. If this is zero (Default), then the returned image will have the same width as the original $hImage.
$iYDesiredPixels | [optional] Specifies the desired height, in pixels, of the image. If this is zero (Default), then the returned image will have the same height as the original $hImage.
$iFlags | [optional] This parameter can be one or more of the following values. $LR_DEFAULTCOLOR (Default) $LR_COPYDELETEORG $LR_COPYFROMRESOURCE $LR_COPYRETURNORG $LR_CREATEDIBSECTION $LR_DEFAULTSIZE $LR_MONOCHROME

## Return Value

Success: | Handle to the newly created image.
Failure: | 0, call _WinAPI_GetLastError() to get extended error information.

## Remarks

When you are finished using the resource, you can release its associated memory by calling _WinAPI_DeleteObject() function respectively for bitmaps, cursors, or icons.
The system automatically deletes the resource when its process terminates, however, calling the appropriate function saves memory and decreases the size of the process's working set.

## See Also

Search CopyImage in MSDN Library.