Can someone explain to me how I could find out what the default icon is for a certain file? TIA.
Printable View
Can someone explain to me how I could find out what the default icon is for a certain file? TIA.
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
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????
:eek: