网站首页  词典首页

请输入您要查询的函数:

 

术语 copyimage
释义 CopyImage
语法:
HANDLE CopyImage( HANDLE hImage,
UINT uType,
int cxDesired,
int cyDesired,
UINT fuFlags
);
CopyImage功能
创建一个新形象(图标,光标或位图)和副本指定图像的属性到新的。如有必要,该函数的位延伸,以适应新的图像所需的大小。
参数
hImage
[in]句柄图像被复制。
uType
[in]指定类型的图像复制。此参数可以是下列值之一。
IMAGE_BITMAP
复本位图。
IMAGE_CURSOR
拷贝光标。
IMAGE_ICON
副本一个图标。
cxDesired
[in]指定所需的宽度,以像素的图像。如果这是零,则返回的图像将与原来的hImage相同的宽度。
cyDesired
[in]指定所需高度,以像素的图像。如果是零,则返回的图像将与原来的hImage相同的高度。
fuFlags
[in]此参数可以是一个或多个下列值。
LR_COPYDELETEORG
删除后创建原始图像的副本。
LR_COPYFROMRESOURCE
尝试重新从原始资源的图标或光标资源文件,而不是简单复制当前图像。这对于建立一个不同大小的副本时,资源文件包含了资源的多个大小。如果没有这个标志,CopyImage原始图像延伸到新的大小。如果设置此标志,CopyImage在资源使用的文件的大小最接近所需的大小。这将取得成功,就hImage是LoadIcon或LoadCursor,或通过与LR_SHARED标志的LoadImage加载。
LR_COPYRETURNORG
返回原来的hImage如果它满足了复制的标准,也就是正确的尺寸和颜色深度,在这种情况下LR_COPYDELETEORG标志被忽略。如果此标志没有被指定,一个新的对象始终是创建。
LR_CREATEDIBSECTION
如果这是一个新的设置和创建位图,该图是一个设备无关的位图(DIB)一节中创建。否则,位图图像创建为依赖于设备的位图。这个标志是唯一有效的,如果uType是IMAGE_BITMAP。
LR_DEFAULTSIZE
使用的宽度或由系统指定高度的游标或图标度量的值,如果cxDesired或cyDesired值设置为零。如果此标志没有被指定的cxDesired和cyDesired设置为零,该函数使用实际资源的大小。如果资源包含多个图像,函数使用第一个图像的大小。
LR_MONOCHROME
创建一个新的黑白图像。
返回值
如果函数成功,返回值是处理到新创建的图像。
如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。
备注
当您使用完的资源,您可以通过调用释放下表中的一个职能及其相关的记忆。
ResourceRelease功能
BitmapDeleteObject
CursorDestroyCursor
IconDestroyIcon
该系统将自动删除该资源时,其进程终止,但是,调用适当的函数可以节省内存和减少了进程的工作集大小。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.5
参见
资源概况,的LoadImage
==英文原文==CopyImage Function
Creates a new image (icon, cursor, or bitmap) and copies the attributes of the specified image to the new one. If necessary, the function stretches the bits to fit the desired size of the new image.
Syntax
HANDLE CopyImage( HANDLE hImage,
UINT uType,
int cxDesired,
int cyDesired,
UINT fuFlags
);
Parameters
hImage
[in] Handle to the image to be copied.
uType
[in] Specifies the type of image to be copied. This parameter can be one of the following values.
IMAGE_BITMAP
Copies a bitmap.
IMAGE_CURSOR
Copies a cursor.
IMAGE_ICON
Copies an icon.
cxDesired
[in] Specifies the desired width, in pixels, of the image. If this is zero, then the returned image will have the same width as the original hImage.
cyDesired
[in] Specifies the desired height, in pixels, of the image. If this is zero, then the returned image will have the same height as the original hImage.
fuFlags
[in] This parameter can be one or more of the following values.
LR_COPYDELETEORG
Deletes the original image after creating the copy.
LR_COPYFROMRESOURCE
Tries to reload an icon or cursor resource from the original resource file rather than simply copying the current image. This is useful for creating a different-sized copy when the resource file contains multiple sizes of the resource. Without this flag, CopyImage stretches the original image to the new size. If this flag is set, CopyImage uses the size in the resource file closest to the desired size. This will succeed only if hImage was loaded by LoadIcon or LoadCursor , or by LoadImage with the LR_SHARED flag.
LR_COPYRETURNORG
Returns the original hImage if it satisfies the criteria for the copy—that is, correct dimensions and color depth—in which case the LR_COPYDELETEORG flag is ignored. If this flag is not specified, a new object is always created.
LR_CREATEDIBSECTION
If this is set and a new bitmap is created, the bitmap is created as a device-independent bitmap (DIB) section. Otherwise, the bitmap image is created as a device-dependent bitmap. This flag is only valid if uType is IMAGE_BITMAP.
LR_DEFAULTSIZE
Uses the width or height specified by the system metric values for cursors or icons, if the cxDesired or cyDesired values are set to zero. If this flag is not specified and cxDesired and cyDesired are set to zero, the function uses the actual resource size. If the resource contains multiple images, the function uses the size of the first image.
LR_MONOCHROME
Creates a new monochrome image.
Return Value
If the function succeeds, the return value is the handle to the newly created image.
If the function fails, the return value is NULL. To get extended error information, call GetLastError .
Remarks
When you are finished using the resource, you can release its associated memory by calling one of the functions in the following table.
ResourceRelease function
BitmapDeleteObject
CursorDestroyCursor
IconDestroyIcon
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.
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.5
See Also
Resources Overview , LoadImage
==原始网址==http://msdn.microsoft.com/en-us/library/ms648031(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:18:30