网站首页  词典首页

请输入您要查询的函数:

 

术语 loadimage
释义 LoadImage
语法:
HANDLE LoadImage( HINSTANCE hinst,
LPCTSTR lpszName,
UINT uType,
int cxDesired,
int cyDesired,
UINT fuLoad
);
LoadImage函数
加载图标,光标,动画光标,或位图。
参数
hinst
[in]句柄的模块或一个DLL或可执行(。exe),其中包含的图像加载。有关更多信息,请参阅GetModuleHandle。注意,从32位Microsoft Windows,一个实例句柄(HINSTANCE),如应用程序的实例处理系统暴露WinMain函数调用,并模块句柄(HMODULE)是一样的。
要加载的OEM的形象,将该参数设置为NULL。
要加载一个独立的资源(图标,光标或位图文件),例如,C:\\ myimage.bmp,将该参数设置为NULL。
lpszName
[in]指定要加载的图像。如果hinst参数非NULL并且fuLoad参数省略LR_LOADFROMFILE,lpszName指定的hinst模块图像资源。如果图像资源,是由名称加载从模块,lpszName参数是一个空指针结尾的字符串,其中包含图像的资源的名称。如果图像资源要加载的模块,由序,使用MAKEINTRESOURCE宏转换成可以被传递给LoadImage函数形式的图像序。
如果hinst参数为NULL和fuLoad参数省略LR_LOADFROMFILE值,lpszName指定的OEM图像加载。 OEM的形象标识定义在Winuser.h中并有下列前缀。
OBM_OEM位图
OIC_OEM图标
OCR_OEM游标
通过这些常量的LoadImage函数,使用MAKEINTRESOURCE宏。例如,要加载OCR_NORMAL光标,通过为lpszName参数,参数的hinst空MAKEINTRESOURCE(OCR_NORMAL)和LR_SHARED作为标志之一fuLoad参数。
如果fuLoad参数包括LR_LOADFROMFILE值,lpszName是该文件包含了独立的资源(图标,光标或位图文件)的名称。因此,设置hinst为NULL。
uType
[in]指定类型的图像加载。此参数可以是下列值之一。
IMAGE_BITMAP
加载一个位图。
IMAGE_CURSOR
加载一个光标。
IMAGE_ICON
加载一个图标。
cxDesired
[in]指定的宽度,以像素为单位的图标或光标。如果这个参数是零,fuLoad参数LR_DEFAULTSIZE,该函数使用SM_CXICON或SM_CXCURSOR系统公制值设定宽度。如果该参数为零,LR_DEFAULTSIZE不使用,该函数使用实际资源的宽度。
cyDesired
[in]指定的高度,以像素为单位的图标或光标。如果这个参数是零,fuLoad参数LR_DEFAULTSIZE,该函数使用SM_CYICON或SM_CYCURSOR制度吨的价格来确定高度。如果该参数为零,LR_DEFAULTSIZE不使用,该函数使用实际资源的高度。
fuLoad
[in]此参数可以是一个或多个下列值。
LR_DEFAULTCOLOR
默认的旗帜,它没有任何反应。所有这意味着“不是LR_MONOCHROME”。
LR_CREATEDIBSECTION
当uType参数指定IMAGE_BITMAP,导致函数返回的DIB位图,而不是第一个兼容的位图。此标志可用于装载不映射到显示设备的位图的颜色。
LR_DEFAULTSIZE
使用的宽度或由系统指定高度的游标或图标度量的值,如果cxDesired或cyDesired值设置为零。如果此标志没有被指定的cxDesired和cyDesired设置为零,该函数使用实际资源的大小。如果资源包含多个图像,函数使用第一个图像的大小。
LR_LOADFROMFILE
加载独立由lpszName(图标,光标或位图文件中指定的文件图像)。
LR_LOADMAP3DCOLORS
搜索图像的颜色表,取代相应的3 - D彩色以下的灰色阴影。 ColorReplaced与
介电常数格雷的RGB(128128128)COLOR_3DSHADOW
格雷的RGB(192,192,192)COLOR_3DFACE
中尉格雷的RGB(223223223)COLOR_3DLIGHT
不要使用此选项如果要加载的颜色深度超过8bpp更大的位图。
LR_LOADTRANSPARENT
获取的图像中第一个像素的颜色值,取代了颜色表中的默认的窗口颜色(COLOR_WINDOW)相应的条目。在图像中的所有像素使用了该项目成为默认窗口的颜色。此值仅适用于图像,具有相应的色表。
您不要使用此选项如果要加载的颜色深度超过8bpp更大的位图。
如果fuLoad既包括LR_LOADTRANSPARENT和LR_LOADMAP3DCOLORS价值观,LRLOADTRANSPARENT优先。但是,颜色表项被替换COLOR_3DFACE而不是COLOR_WINDOW。
LR_MONOCHROME
加载图像黑色和白色。
LR_SHARED
图像处理的股票如果图像加载多次。如果LR_SHARED没有设置,第二个要求相同资源的LoadImage将加载图像再次返回一个不同的处理。
当您使用此标志时,系统会破坏资源时,不再需要。
不要使用LR_SHARED的图像,非标准尺寸,可能有所变动,装货,或者是从文件加载。
当加载一个系统图标或光标,您必须使用LR_SHARED或函数将无法加载资源。
此功能处于与请求的资源名称缓存的第一幅图片,无论大小的要求。
LR_VGACOLOR
使用真正具有VGA颜色。
返回值
如果函数成功,返回值是处理新加载图像。
如果函数失败,返回值为NULL。为了获得更多错误信息,调用GetLastError。
备注
当您使用完毕一个位图,光标或图标不指定LR_SHARED旗装,您可以通过调用释放下表中的一个职能及其相关的记忆。
ResourceRelease功能
BitmapDeleteObject
CursorDestroyCursor
IconDestroyIcon
该系统将自动删除这些资源的过程时,创建它们的终止,但是,调用适当的函数可以节省内存和减少了进程的工作集大小。
在Windows 95/98/Me:LoadImageW是支持的Unicode(MSLU)微软层。要使用此,您必须将某些文件到您的应用,概述了对Unicode的Microsoft层在Windows 95/98/Me系统。
例如
有关示例,请参阅使用窗口类。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 4.0
UnicodeImplemented为ANSI和Unicode版本。
参见
资源概况,CopyImage,GetSystemMetrics,LoadBitmap,LoadCursor,LoadIcon
==英文原文==LoadImage Function
Loads an icon, cursor, animated cursor, or bitmap.
Syntax
HANDLE LoadImage( HINSTANCE hinst,
LPCTSTR lpszName,
UINT uType,
int cxDesired,
int cyDesired,
UINT fuLoad
);
Parameters
hinst
[in] Handle to the module of either a DLL or executable (.exe) that contains the image to be loaded. For more information, see GetModuleHandle . Note that as of 32-bit Microsoft Windows, an instance handle (HINSTANCE), such as the application instance handle exposed by system function call of WinMain , and a module handle (HMODULE) are the same thing.
To load an OEM image, set this parameter to NULL.
To load a stand-alone resource (icon, cursor, or bitmap file)—for example, c:\\myimage.bmp—set this parameter to NULL.
lpszName
[in] Specifies the image to load. If the hinst parameter is non-NULL and the fuLoad parameter omits LR_LOADFROMFILE, lpszName specifies the image resource in the hinst module. If the image resource is to be loaded by name from the module, the lpszName parameter is a pointer to a null-terminated string that contains the name of the image resource. If the image resource is to be loaded by ordinal from the module, use the MAKEINTRESOURCE macro to convert the image ordinal into a form that can be passed to the LoadImage function.
If the hinst parameter is NULL and the fuLoad parameter omits the LR_LOADFROMFILE value, the lpszName specifies the OEM image to load. The OEM image identifiers are defined in Winuser.h and have the following prefixes.
OBM_OEM bitmaps
OIC_OEM icons
OCR_OEM cursors
To pass these constants to the LoadImage function, use the MAKEINTRESOURCE macro. For example, to load the OCR_NORMAL cursor, pass MAKEINTRESOURCE(OCR_NORMAL) as the lpszName parameter, NULL as the hinst parameter, and LR_SHARED as one of the flags to the fuLoad parameter.
If the fuLoad parameter includes the LR_LOADFROMFILE value, lpszName is the name of the file that contains the stand-alone resource (icon, cursor, or bitmap file). Therefore, set hinst to NULL.
uType
[in] Specifies the type of image to be loaded. This parameter can be one of the following values.
IMAGE_BITMAP
Loads a bitmap.
IMAGE_CURSOR
Loads a cursor.
IMAGE_ICON
Loads an icon.
cxDesired
[in] Specifies the width, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CXICON or SM_CXCURSOR system metric value to set the width. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource width.
cyDesired
[in] Specifies the height, in pixels, of the icon or cursor. If this parameter is zero and the fuLoad parameter is LR_DEFAULTSIZE, the function uses the SM_CYICON or SM_CYCURSOR system metric value to set the height. If this parameter is zero and LR_DEFAULTSIZE is not used, the function uses the actual resource height.
fuLoad
[in] This parameter can be one or more of the following values.
LR_DEFAULTCOLOR
The default flag; it does nothing. All it means is "not LR_MONOCHROME".
LR_CREATEDIBSECTION
When the uType parameter specifies IMAGE_BITMAP, causes the function to return a DIB section bitmap rather than a compatible bitmap. This flag is useful for loading a bitmap without mapping it to the colors of the display device.
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_LOADFROMFILE
Loads the stand-alone image from the file specified by lpszName (icon, cursor, or bitmap file).
LR_LOADMAP3DCOLORS
Searches the color table for the image and replaces the following shades of gray with the corresponding 3-D color. ColorReplaced with
Dk Gray, RGB(128,128,128)COLOR_3DSHADOW
Gray, RGB(192,192,192)COLOR_3DFACE
Lt Gray, RGB(223,223,223)COLOR_3DLIGHT
Do not use this option if you are loading a bitmap with a color depth greater than 8bpp.
LR_LOADTRANSPARENT
Retrieves the color value of the first pixel in the image and replaces the corresponding entry in the color table with the default window color (COLOR_WINDOW). All pixels in the image that use that entry become the default window color. This value applies only to images that have corresponding color tables.
Do not use this option if you are loading a bitmap with a color depth greater than 8bpp.
If fuLoad includes both the LR_LOADTRANSPARENT and LR_LOADMAP3DCOLORS values, LRLOADTRANSPARENT takes precedence. However, the color table entry is replaced with COLOR_3DFACE rather than COLOR_WINDOW.
LR_MONOCHROME
Loads the image in black and white.
LR_SHARED
Shares the image handle if the image is loaded multiple times. If LR_SHARED is not set, a second call to LoadImage for the same resource will load the image again and return a different handle.
When you use this flag, the system will destroy the resource when it is no longer needed.
Do not use LR_SHARED for images that have non-standard sizes, that may change after loading, or that are loaded from a file.
When loading a system icon or cursor, you must use LR_SHARED or the function will fail to load the resource.
This function finds the first image in the cache with the requested resource name, regardless of the size requested.
LR_VGACOLOR
Uses true VGA colors.
Return Value
If the function succeeds, the return value is the handle of the newly loaded image.
If the function fails, the return value is NULL. To get extended error information, call GetLastError .
Remarks
When you are finished using a bitmap, cursor, or icon you loaded without specifying the LR_SHARED flag, 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 these resources when the process that created them terminates; however, calling the appropriate function saves memory and decreases the size of the process's working set.
Windows 95/98/Me: LoadImageW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems .
Example
For an example, see Using Window Classes .
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 4.0
UnicodeImplemented as ANSI and Unicode versions.
See Also
Resources Overview , CopyImage , GetSystemMetrics , LoadBitmap , LoadCursor , LoadIcon
==原始网址==http://msdn.microsoft.com/en-us/library/ms648045(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 11:31:22