News:

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

getting ordinal icon from shell32.dll to use on form

Started by ChillyWilly, September 16, 2009, 05:20:48 PM

Previous topic - Next topic

ChillyWilly

trying to load and use the icons inside shell32.dll to use on my form instead of loading them from a resource

invoke GetModuleHandle,CTEXT("c:\windows\system32\Shell32.DLL")
invoke GetProcAddress,eax,160                                                    ;160 should be the "run" icon
invoke Shell_GetImageLists,offset hSysImlLarge,offset hSysImlSmall


   


now how do i call SHGetFileInfo to pull the small icon from the dll ?

dedndave

there was a thread about this just a couple weeks ago
try searching "shell32.dll icon"


ChillyWilly

invoke SHGetFileInfo,CTEXT("c:\windows\system32\Shell32.DLL"),0,addr sfi,\
sizeof SHFILEINFO,SHGFI_SYSICONINDEX or SHGFI_ICON or SHGFI_SMALLICON
INVOKE SendDlgItemMessage,hWin,1015,STM_SETIMAGE,IMAGE_ICON,sfi.SHFILEINFO.hIcon   


something like that gets me the dll's icon , im looking to get the smallest icon from the icon in the shell32.dll

i did it for the exes, but i need folder icons and the run icon for my app





ChillyWilly

#5
thanx  :U i do tech work and some of it involves removing spyware so i made this to help a little


i think that link is for only loading a bmp image in the toolbar

donkey

If you're just looking for a single icon, why bother with loading the image lists ? Just use LoadImage...

invoke GetModuleHandle,CTEXT("c:\windows\system32\Shell32.DLL")
invoke LoadImage, eax, 160, IMAGE_ICON, NULL, NULL, LR_SHARED
mov [hIcon],eax


Note that you should always use the LR_SHARED flag when using images from system files.

For an example of using the system image lists you can look at my WinExplorer example on my website.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

ChillyWilly

awesome i just found your site earlier and downloaded it

invoke GetModuleHandle,CTEXT("c:\windows\system32\Shell32.DLL")
invoke LoadImage, eax, 160, IMAGE_ICON, 16, 16, LR_SHARED
INVOKE SendDlgItemMessage,hWin,1015,STM_SETIMAGE,IMAGE_ICON,eax

works like a charm  :dance:

ChillyWilly

quick question if i had an icon as a resource in my program and wantedto loadit the same way would i use
   invoke   LoadIcon,hInstance,300
       invoke SendDlgItemMessage,hWin,1022,STM_SETIMAGE,IMAGE_ICON, eax

is there any way to allow me to choose to size it 16x16 small

ChillyWilly

ah i figured it out  :U
invoke LoadImage, hInstance, 300, IMAGE_ICON, 16, 16, LR_SHARED
mov [win],eax
       INVOKE SendDlgItemMessage,hWin,1023,STM_SETIMAGE,IMAGE_ICON, [win]