
Option Explicit
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex 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
Function DrawShellIcon(ByVal hDc As Long, ByVal x As Long, ByVal y As Long, ByVal iCount As Long) As Long
Dim sBuf As String
sBuf = Space$(256)
Call GetSystemDirectory(sBuf, 256)
sBuf = Left$(sBuf, InStr(sBuf, Chr(0)) - 1) & "\shell32.dll"
DrawShellIcon = ExtractIcon(App.hInstance, sBuf, iCount)
If DrawShellIcon Then
Call DrawIcon(hDc, x, y, DrawShellIcon)
Call DestroyIcon(DrawShellIcon)
End If
End Function
Private Sub Command1_Click()
Call DrawShellIcon(Me.hDc, 0, 0, 235)
End Sub
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function ExtractIcon Lib "shell32.dll" Alias "ExtractIconA" (ByVal hInst As Long, ByVal lpszExeFileName As String, ByVal nIconIndex 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
Function DrawShellIcon(ByVal hDc As Long, ByVal x As Long, ByVal y As Long, ByVal iCount As Long) As Long
Dim sBuf As String
sBuf = Space$(256)
Call GetSystemDirectory(sBuf, 256)
sBuf = Left$(sBuf, InStr(sBuf, Chr(0)) - 1) & "\shell32.dll"
DrawShellIcon = ExtractIcon(App.hInstance, sBuf, iCount)
If DrawShellIcon Then
Call DrawIcon(hDc, x, y, DrawShellIcon)
Call DestroyIcon(DrawShellIcon)
End If
End Function
Private Sub Command1_Click()
Call DrawShellIcon(Me.hDc, 0, 0, 235)
End Sub





