Results 1 to 4 of 4

Thread: Icons have stumped me yet again...

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207

    Post

    Ok, I now know more about Icons than I could ever imagine. I've used the following API's to extract and display Icons ... and played with tons of flags and parameters:

    Declare Function ExtractAssociatedIcon Lib "shell32.dll" Alias "ExtractAssociatedIconA" (ByVal hInst As Long, ByVal lpIconPath As String, lpiIcon As Long) As Long
    Declare Function DrawIconEx Lib "user32" (ByVal hdc As Long, ByVal xLeft As Long, ByVal yTop As Long, ByVal hIcon As Long, ByVal cxWidth As Long, ByVal cyWidth As Long, ByVal istepIfAniCur As Long, ByVal hbrFlickerFreeDraw As Long, ByVal DIFlags As Long) As Long
    Declare Function DestroyIcon Lib "user32.dll" (ByVal hIcon As Long) As Long
    Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
    Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex As Long) As Long
    Declare Function ExtractIconEx Lib "shell32.dll" Alias "ExtractIconExA" (ByVal lpszFile As String, ByVal nIconIndex As Long, phiconLarge As Long, phiconSmall As Long, ByVal nIcons As Long) As Long
    Public Declare Function GetIconInfo Lib "user32" (ByVal hIcon As Long, piconinfo As ICONINFO) As Long

    The one I'm deciding to stick with is the original one I had which aaron had given me the code to which is ExtractAssosiatedIcon() and DrawIconEX().

    The problem is, I need the 16x16 variation of the icon and when I specify 16x16 as the size it merely shrinks the 32x32 variation into a 16x16, and therefore looks crappy.

    ....ieas people? Perhaps using GetSystemMetrics in some way?

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    It would have to be embedded in the file.

    ------------------
    DiGiTaIErRoR

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207

    Post

    Yes, I know how to extract one of all of the icons embeded or assosiated with a program, the problem is it extracts the 32x32 variation of each, where each Icon (usually) has a 16x16 one as well (ie the one that shows up in the titlebar, taskbar, and in details explorer mode).

    Man these Icons'll be the death of me.

  4. #4
    Registered User
    Join Date
    Apr 1999
    Location
    Brazil
    Posts
    144

    Post

    ExtractIconEx return two images:
    hLargeIcon, and hSmallIcon, are you using the correct one?

    Look this peace of code:

    ------------

    Dim pic As PicBmp
    Dim IPic As IPicture
    Dim IID_IDispatch As GUID

    'Open FileName For Binary Access Read Shared As #1

    If ExtractIconEx(FileName, IconIndex, hLargeIcon, hSmallIcon, 1) > 0 Then


    ------------

    Boa sorte!
    Jefferson

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width