LoadIcon的使用

6919 Views

Type: LPCTSTR

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.

在初始化时,我们可以这样使用:

wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;

使用系统预定义图标,必须把第一个参数设置为NULL.

相应的显示:

另外,我们也可以使用自定义的图标:

用到MAKEINTRESOURCE宏

MAKEINTRESOURCE

Converts an integer value to a resource type compatible with the resource-management functions. This macro is used in place of a string containing the name of the resource.

Syntax

C++

LPTSTR MAKEINTRESOURCE(

WORD wInteger

);

Parameters

wInteger

The integer value to be converted.

说说使用:

在VS2012下的Resource View下的项目添加ICO文件,它会生成ID号,默认的IDI_ICON1.

引入resource.h

修改如下:

wndclass.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_ICON1)) ;

形容月亮的成语1
谭松韵为什么好显小 30岁的年龄长相却如同高中生