Re: Using Win32Lib's geFileInfo to show system icon

new topic     » goto parent     » topic index » view thread      » older message » newer message

> 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


new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu