Code: Select all
OpenWindow(0,200,200,320,240,"",#PB_Window_SystemMenu)
Structure GRPICONDIRENTRY
bWidth.b ;/ Width, in pixels, of the image
bHeight.b ;/ Height, in pixels, of the image
bColorCount.b ;/ Number of colors in image (0 if >=8bpp)
bReserved.b ;/ Reserved
wPlanes.w ;/ Color Planes
wBitCount.w ;/ Bits per pixel
dwBytesInRes.l ;/ how many bytes in this resource?
nID.w ;/ the ID
EndStructure
Structure GRPICONDIR
idReserved.w ;/ Reserved (must be 0)
idType.w ;/ Resource type (1 for icons)
idCount.w ;/ How many images?
idEntries.GRPICONDIRENTRY[0] ;/ The entries for each image
EndStructure
Structure ICONIMAGE
icHeader.BITMAPINFOHEADER ;/ DIB header
icColors.RGBQUAD[0] ;/ Color table
icXOR.b[0] ;/ DIB bits for XOR mask
icAND.b[0] ;/ DIB bits for AND mask
EndStructure
#LOAD_LIBRARY_AS_DATAFILE=2
Lib=LoadLibraryEx_("C:\WINDOWS\system32\progman.exe",0,#LOAD_LIBRARY_AS_DATAFILE)
*lpGrpIconDir.GRPICONDIR=LoadResource_(Lib,FindResource_(Lib,147,#RT_GROUP_ICON))
;/ Load large MSDOS icon
*lpIconImage.ICONIMAGE=LoadResource_(Lib,FindResource_(Lib,*lpGrpIconDir\idEntries[3]\nID,#RT_ICON))
hIcon=CreateIconFromResource_(*lpIconImage,*lpIconImage\icHeader\biBitCount,1,$00030000)
PostMessage_(WindowID(0),#WM_SETICON,1,hIcon)
;/ Load small MSDOS icon
*lpIconImage.ICONIMAGE=LoadResource_(Lib,FindResource_(Lib,*lpGrpIconDir\idEntries[7]\nID,#RT_ICON))
hIcon=CreateIconFromResource_(*lpIconImage,*lpIconImage\icHeader\biBitCount,1,$00030000)
PostMessage_(WindowID(0),#WM_SETICON,0,hIcon)
Repeat
Until WaitWindowEvent()=#WM_CLOSE
End
Code: Select all
*lpIconImage.ICONIMAGE=LoadResource_(0,FindResource_(0,1,#RT_ICON))
hIcon=CreateIconFromResource_(*lpIconImage,*lpIconImage\icHeader\biBitCount,1,$00030000)