Extract,Draw and Destroy Icon using ExtractIcon,DrawIcon and DestroyIcon API
Extract,Draw and Destroy Icon using ExtractIcon,DrawIcon and DestroyIcon API
API Declarations
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
Dim hicon As Long ' Handle to icon
Dim rval As Long ' Return value
Dim index As Long 'Icon index
Rate Extract,Draw and Destroy Icon using ExtractIcon,DrawIcon and DestroyIcon API
(1(1 Vote))
'Extract and Draw Icon for index=0
index = 0
Form1.Cls ' Clear the form
'Extract Icon from explorer.exe of index=0
hicon = ExtractIcon(App.hInstance, "c:\windows\explorer.exe", index)
rval = DrawIcon(Form1.hdc, 15, 15, hicon) 'draw icon on form
rval = DestroyIcon(hicon) 'Destroy the icon handle
'Extract and Draw Icon for index=0
index = 1
'Extract Icon from explorer.exe of index=1
hicon = ExtractIcon(App.hInstance, "c:\windows\explorer.exe", index)
rval = DrawIcon(Form1.hdc, 50, 15, hicon) 'draw icon on form
rval = DestroyIcon(hicon) 'Destroy the icon handle
End Sub
Extract,Draw and Destroy Icon using ExtractIcon,DrawIcon and DestroyIcon API Comments
No comments yet — be the first to post one!
Post a Comment