16,473
社区成员
发帖
与我相关
我的任务
分享
HRSRC hRes=FindResource(NULL,MAKEINTRESOURCE(IDR_MAINFRAME),RT_ICON);
HRSRC hRes=FindResource(NULL,MAKEINTRESOURCE(IDR_MAINFRAME),RT_GROUP_ICON);
CString str;
str.Format("%d",SizeofResource(NULL,hRes));
MessageBox(str);
#pragma pack(1)
typedef struct _GRPICONDIRENTRY {
BYTE bWidth; // Width, in pixels, of the image
BYTE bHeight; // Height, in pixels, of the image
BYTE bColorCount; // Number of colors in image (0 if >=8bpp)
BYTE bReserved; // Reserved
WORD wPlanes; // Color Planes
WORD wBitCount; // Bits per pixel
DWORD dwBytesInRes; // how many bytes in this resource?
WORD nID; // the ID
} GRPICONDIRENTRY, *LPGRPICONDIRENTRY;
typedef struct _GRPICONDIR {
WORD idReserved; // Reserved (must be 0)
WORD idType; // Resource type (1 for icons)
WORD idCount; // How many images?
GRPICONDIRENTRY idEntries[1]; // The entries for each image
} GRPICONDIR, *LPGRPICONDIR;
#pragma pack()
HRSRC hRes = FindResource(NULL, MAKEINTRESOURCE(IDI_ICON), RT_GROUP_ICON);
HGLOBAL hGlobal = LoadResource(NULL, hRes);
LPVOID lpIconDir = LockResource(hGlobal);
hRes = FindResource(NULL, MAKEINTRESOURCE(((LPGRPICONDIR)lpIconDir)->idEntries[0].nID ), RT_ICON);
hGlobal = LoadResource(NULL, hRes);
LPVOID lpIcon = LockResource(hGlobal);