# 从exe中取图

Posted by 小刘 on February 16, 1998 at 20:12:45:

In Reply to: Re: 两个问题想请教各位高手......... posted by 小吴 on February 16, 1998 at 17:30:15:

Form 中有两个物件 Command1 及 Picture1
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 Sub Command1_Click()
Dim hIcon As Long, Reg As Long

hIcon = ExtractIcon(0, "c:\win95\notepad.exe", 1)
Reg = DrawIcon(Picture1.hdc, 0, 0, hIcon)

End Sub

Follow Ups: