Private sIconFile As String
Private twipsX As Long
Private twipsY As Long
Private picH As Long
Private picW 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 ExtractIcon Lib "shell32" _
Alias "ExtractIconA" _
(ByVal hInst As Long, _
ByVal lpszExeFileName As String, _
ByVal nIconIndex As Long) As Long
Private Declare Function DestroyIcon Lib "user32" _
(ByVal hIcon As Long) As Long
Private Sub Form_Load()
sIconFile = "c:\windows\system32\shell32.dll"
twipsX = Screen.TwipsPerPixelX
twipsY = Screen.TwipsPerPixelY
picH = Picture1.ScaleWidth
picW = Picture1.ScaleWidth
Label1.Caption = sIconFile
End Sub
in un command button
hIcon = ExtractIcon(0&, sIconFile, index)
Call DrawIcon(Picture1.hdc, X, Y, hIcon)
Call DestroyIcon(hIcon)

Rispondi quotando