LoadIcon函数怎么用?

LoadIconFunctionTheLoadIconfunctionloadsthespecifiediconresourcefromtheexecutable(.ex... LoadIcon Function

The LoadIcon function loads the specified icon resource from the executable (.exe) file associated with an application instance.

Note This function hase been superseded by the LoadImage function.
Syntax

HICON LoadIcon( HINSTANCE hInstance,
LPCTSTR lpIconName
);

Parameters

hInstance
[in] Handle to an instance of the module whose executable file contains the icon to be loaded. This parameter must be NULL when a standard icon is being loaded.
lpIconName
[in]
Pointer to a null-terminated string that contains the name of the icon resource to be loaded. Alternatively, this parameter can contain the resource identifier in the low-order word and zero in the high-order word. Use the MAKEINTRESOURCE macro to create this value.

To use one of the predefined icons, set the hInstance parameter to NULL and the lpIconName parameter to one of the following values.

IDI_APPLICATION
Default application icon.
IDI_ASTERISK
Same as IDI_INFORMATION.
IDI_ERROR
Hand-shaped icon.
IDI_EXCLAMATION
Same as IDI_WARNING.
IDI_HAND
Same as IDI_ERROR.
IDI_INFORMATION
Asterisk icon.
IDI_QUESTION
Question mark icon.
IDI_WARNING
Exclamation point icon.
IDI_WINLOGO
Windows logo icon. Windows XP: Default application icon.
IDI_SHIELD
Security Shield icon.
Return Value

If the function succeeds, the return value is a handle to the newly loaded icon.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

这段话好象说什么标准Icon第一个参数是NULL,第二个参数是标准Icon的句柄
那如果是非标准光标该怎么传参数?比如我定义了一个名为1.bmp的光标
展开
 我来答
luosiyong
2008-09-30 · TA获得超过3256个赞
知道大有可为答主
回答量:1090
采纳率:0%
帮助的人:1623万
展开全部
bmp的文件和ico文件不一样,所以不能加载,否则系统报错。
如果是ico文件的可以这么加载:
1,在窗口类中设置:
cwnd.hIcon=(HICON)LoadImage(NULL,"1.ico",IMAGE_ICON,0,0,LR_LOADFROMFILE);
2,动态设置:
hIcon=(HICON)LoadImage(NULL,"1.ico",IMAGE_ICON,0,0,LR_LOADFROMFILE);
SetIcon(...);
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式