加载图标

//1.从应用程序的资源中装入一个图标装入一个在应用程序资源中定义的图标,用:
HICON hicon;
hicon
=AfxGetApp()->LoadIcon(IDR_MAINFRAME);

//2.直接从一个.ico磁盘文件中装入一个图标从一个.ico文件装入一个图标,使用下面的方法。本例从Wzd.ico装入一个图标。
hicon=(HICON)LoadImage(
NULL,
//handle of the instance that contains //the image
"Wzd.ico",//name or identifier of image
IMAGE_ICON,//type of image-can also be IMAGE_CURSOR or MAGE_ICON
0,0,//desired width and height
LR_LOADFROMFILE);//load flags

//3.从一个DLL或.exe文件中装入一个图标从另一个应用程序的可执行文件中抽取一个图标,可以用下面的方法。本例中抽取在Wzd.exe中发现的第二个图标。
HINSTANCE hinst=AfxGetInstanceHandle();
hicon
=ExtractIcon(hinst,"%SystemRoot%\system32\SHELL32.dll",1);

要确定一个可执行文件或DLL文件有多少个图标,用
索引值为1调用ExtractIcon(),图标数
量返回到hIcon中
原文地址:https://www.cnblogs.com/emyueguang/p/2033534.html