About the API ImageList_GetImageInfo(...)

Hello, everybody, when I used ImageList, I used ImageList_GetImageInfo(...), but I didn't get the right infomation.
I used the ImageList not for Toolbar or Listview, I just want to get each single image data from the ImageList.
The picture I used was 180x25x256, I wanted to split it to 12 images.
Thanks.



sPerXY db "=%d=, =%d=",0
sBuffer db MAX_PATH dup(?)

TestProc proc
local hImage:HANDLE
local stIF:IMAGEINFO
local hImageList:HIMAGELIST

;---Create the ImageList, specify the size of each image
invoke ImageList_Create, 15, 25, ILC_COLOR8, 12, 0
test eax, eax
jz Exit_Error
mov hImageList, eax

;---Load the image from the resource, and add it to the ImageList
invoke LoadImage, hInstMain, IDB_NUMBER, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR
test eax, eax
jz Exit_Error
mov hImage, eax
invoke ImageList_Add, hImageList, eax, NULL
cmp eax, -1
jz Exit_Error
invoke DeleteObject, hImage

;???????????????????????????????????????????????????????????????????????????????
;---Get the infomation or the first image
invoke ImageList_GetImageInfo, hImageList, 0, addr stIF
invoke GetObject, stIF.hbmImage, sizeof BITMAP, addr stBmp
;Show the info, but I didn't get the right infomation ????????????????????
invoke wsprintf, addr sBuffer, addr sPerXY, stBmp.bmWidth, stBmp.bmHeight
invoke MessageBox, 0, addr sBuffer, NULL, MB_OK
;invoke MyFunction, stIF.hbmImage ; Use the image data

;---Destroy the ImageList
invoke ImageList_Destroy, hImageList

Exit_Error:
ret
TestProc endp


Posted on 2003-09-27 23:17:35 by seasea