News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

LookupIconIdFromDirectory ???

Started by xandaz, September 17, 2010, 07:30:44 PM

Previous topic - Next topic

xandaz

   Hi there. I've been trying to find icon id's for RT_GROUP_ICON and ..._CURSOR in resource files but i've been unsuccessful. I'm posting the code. Hope someone sees what's wrong.
invoke FindResource,lpszName,lpszType
mov hResFind,eax
invoke LoadResource,hResource,hResFind
invoke LockResource,eax
invoke LookupIconIdFromDirectory,eax,FALSE
invoke FindResource,eax,lpszType
mov hResFind,eax
invoke LoadResource,hResource,hResFind
mov hResLoad,eax
invoke LockResource,eax
mov lpRes,eax
invoke SizeofResource,hResource,hResFind
invoke CreateIconFromResource,lpRes,eax,FALSE,030000h
push eax
invoke ImageList_AddIcon,hList,eax
mov lvi.iImage,eax
invoke SendMessage,hListView,LVM_INSERTITEM,NULL,addr lvi
pop eax
invoke DestroyIcon,eax


Thanks guys and bye

xandaz

   Looked around and found the fix for it. The Second time FindResource is called, right after the LookipIconIdFromDirectory, lpszType must be RT_ICON/RT_CURSOR and not RT_GROUP_ICON/CURSOR. So it becomes like this

invoke FindResource,lpszName,lpszType
mov hResFind,eax
invoke LoadResource,hResource,hResFind
invoke LockResource,eax
invoke LookupIconIdFromDirectory,eax,FALSE ; False because its a cursor
invoke FindResource,eax,RT_CURSOR
mov hResFind,eax
invoke LoadResource,hResource,hResFind
mov hResLoad,eax
invoke LockResource,eax
mov lpRes,eax
invoke SizeofResource,hResource,hResFind
invoke CreateIconFromResource,lpRes,eax,FALSE,030000h
push eax
invoke ImageList_AddIcon,hList,eax
mov lvi.iImage,eax
invoke SendMessage,hListView,LVM_INSERTITEM,NULL,addr lvi
pop eax
invoke DestroyIcon,eax