Re: Using Win32Lib's geFileInfo to show system icon
- Posted by Greg Haberek <ghaberek at gmail.com> Jan 25, 2006
- 444 views
> It's working now but I guess I need to figure out how to use both my cust= om icons and icons from the system. Here's a screen shot of the window: Um... why not use a function that returns the handle to an icon, not its image list index? Have you looked at ExtractAssociatedIcon? There's a Win32Lib demo called icon00.exw. Here's a wrapper for the function.
global constant xExtractAssociatedIcon = registerw32Function( shell32, "ExtractAssociatedIconA", {C_INT,C_POINTER,C_POINTER}, C_INT ) global function extractAssociatedIcon( sequence pFilename ) atom mset, hInst, lpIconPath, lpiIcon, hIcon mset = w32new_memset() hInst = instance() lpIconPath = w32acquire_mem( mset, pFilename ) lpiIcon = w32acquire_mem( mset, Word ) hIcon = w32Func( xExtractAssociatedIcon, {hInst, lpIconPath, lpiIcon}= ) w32release_mem( mset ) return hIcon end function