Click to See Complete Forum and Search --> : How to display Large Icons w.r.t Application just like in Windows Explorer ?


October 6th, 1999, 07:07 AM
Hi,

How to display Large Icons for Application Specific. Just as we get in Windows Explorer. How to get the icon for that application from the registry.

Please let me know imeediately

contact : Kpra24@hotmail.com

Regards

Prasad

Aaron Young
October 6th, 1999, 02:50 PM
Try using the ExtractAssociatedIcon API, here's an Example:

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()
Dim lIcon as Long
on error GoTo User_Cancelled
With CommonDialog1
.CancelError = true
.DialogTitle = "Select a File.."
.Filter = "All Files (*.*)|*.*"
.ShowOpen
Picture1.Cls
lIcon = ExtractAssociatedIcon(App.hInstance, .FileName, -1)
Call DrawIconEx(Picture1.hdc, 0, 0, lIcon, 32, 32, 0, 0, 3)
End With
User_Cancelled:
End Sub





<STRONG>Aaron Young</STRONG>
<EM>Analyst Programmer</EM>
<A HREF="Mailto:adyoung@win.bright.net">adyoung@win.bright.net</A>
<A HREF="Mailto:aarony@redwingsoftware.com">aarony@redwingsoftware.com</A>