Results 1 to 3 of 3

Thread: get apps default icon

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 1999
    Posts
    52

    Question

    Can someone explain to me how I could find out what the default icon is for a certain file? TIA.
    -Adam
    Yahoo!: _eclipsed_
    ICQ:18534929

  2. #2
    Guest
    This code will work.


    Code:
    'Needed:  Command Button, Picturebox
    
    Private Declare Function ExtractAssociatedIcon _
    Lib "shell32.dll" Alias "ExtractAssociatedIconA" (ByVal _
    hInst As Long, ByVal lpIconPath As String, lpiIcon As _
    Long) As Long
    
    Private 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
    
    
    Private Sub Command1_Click()
    
    'extract icon from Notepad.exe
    lIcon = ExtractAssociatedIcon(App.hInstance, "C:\Windows\Notepad.exe", -1)
    Call DrawIconEx(Picture1.hdc, 0, 0, lIcon, 32, 32, 0, 0, 3)
    
    End Sub

  3. #3
    Lively Member
    Join Date
    Sep 2000
    Posts
    68
    Thanks m8,

    One Problem, That returns the handle to an Icon, I d onot know how, or if you can, use this within controls like the ImageList????

    THE DOUGSTER!!!!!!


    *-MCSD-*

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