Icone associé au fichier

Flyer - 10 juil. 2001 à 15:40
 Flyer - 12 juil. 2001 à 16:23
Bonjour,
Comment je peut faire pour récupérer les icones associé a chaque type de fichier dans VB ?
PAr exemple pour avoir les icones winzip pour les extensions zip, ect...Merci

2 réponses

Salut :big)

Utilises l'API:
Declare Function ExtractAssociatedIcon Lib "shell32.dll" Alias "ExtractAssociateIconA" (ByVal hInst As Long, ByVal lpIconPath As String, lpiIcon As Long) As Long


elle extrai l'icone d'un fichier
pour afficher cette icone :

Declare Function DrawIcon Lib "user32" Alias "DrawIcon" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long


exemple d'utilisation:

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 DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function DestroyIcon Lib "user32" (ByVal hIcon As Long) As Long
Private Sub Form_Paint()

    Dim mIcon As Long

    mIcon = ExtractAssociatedIcon(App.hInstance, "C:\Autoexec.bat", 2)

   DrawIcon Me.hdc, 0, 0, mIcon

    DestroyIcon mIcon
End Sub


voila
@+
Fabs 8-)

12WareSoft WebSite
0
Merci C cool
0
Rejoignez-nous