VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Draw Any Icon on form

by Dennis John (3 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 2nd January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Draw Any Icon on form

API Declarations


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 Draw Any Icon on form



Private Sub Command1_Click()
index = 0
'Extract Icon from explorer.exe of index=0
'Give the path of any icon
hicon = ExtractIcon(App.hInstance, "c:\windows\WINUPD.ICO", index)
rval = DrawIcon(Form1.hdc, 150, 150, hicon) 'draw icon on form
rval = DestroyIcon(hicon) 'Destroy the icon handle
'Extract and Draw Icon for index=0
End Sub

Download this snippet    Add to My Saved Code

Draw Any Icon on form Comments

No comments have been posted about Draw Any Icon on form. Why not be the first to post a comment about Draw Any Icon on form.

Post your comment

Subject:
Message:
0/1000 characters