Y
yxq
Thank Armin Zingler, the codes below work well!
But i want to put the icon into Picturebox1 instead of the Form1, how to do?
the code
**************************
If retval <> 0 Then
Dim g As Graphics
Dim ico As Icon
Dim hIcon As IntPtr ' handle to the icon once it is extracted
hIcon = ExtractIcon(VB6.GetHInstance, iconfile, iconindex)
ico = Icon.FromHandle(hIcon)
p.Image.FromHbitmap(hIcon)
g = Form1.DefInstance.CreateGraphics
g.DrawIcon(ico, 0, 0)
g.Dispose()
retval = DestroyIcon(hIcon.ToInt32)
End If
***************************
But i want to put the icon into Picturebox1 instead of the Form1, how to do?
the code
**************************
If retval <> 0 Then
Dim g As Graphics
Dim ico As Icon
Dim hIcon As IntPtr ' handle to the icon once it is extracted
hIcon = ExtractIcon(VB6.GetHInstance, iconfile, iconindex)
ico = Icon.FromHandle(hIcon)
p.Image.FromHbitmap(hIcon)
g = Form1.DefInstance.CreateGraphics
g.DrawIcon(ico, 0, 0)
g.Dispose()
retval = DestroyIcon(hIcon.ToInt32)
End If
***************************