业务运维体系架构图:VB6.0同行来看看

来源:百度文库 编辑:高考问答 时间:2024/04/29 16:04:52
我用VB6。0参照书上编了一个图标抓取器,但是却抓不到图标
代码如下:
'声明部分
Dim licon As Long
Dim ssourcepgm As String
Dim sdestfile As String
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
'打开文件
Private Sub cmdopen_click()
Dim a%
On Error Resume Next
With dlg
.FileName = ssourcepgm
.CancelError = True
.Action = 1
ssourcepgm = .FileName
Text3.Text = .FileName
destroyicon licon
Do
licon = extracticon(App.hInstance, ssourcepgm, a)
If licon = 0 Then Exit Do
a = a + 1
destroyicon licon
Loop
If a = 0 Then
MsgBox "在这个文件中没有任何图标!"
End If
Text1.Text = "在这个文件中共有" & a & "个图标"
VScroll1.Max = IIf(a = 0, 0, a - 1)
VScroll1.Value = 0
vscroll1_change
End With
End Sub
'保存图标
Private Sub cmdsave_click()
On Error Resume Next
With dlg
.FileName = sdestfile
.CancelError = True
.Action = 2
sdestfile = .FileName
SavePicture Picture1.Image, sdestfile '将抓取的图标保存
End With
End Sub
'退出程序
Private Sub cmdexit_click()
Unload Me
End Sub
'浏览图标
Private Sub vscroll1_change()
Text2.Text = "正在浏览第" & (VScroll1.Value + 1) & "个图标"
destroyicon licon
Picture1.Cls
licon = extracticon(App.hInstance, ssourcepgm, VScroll1.Value)
Picture1.AutoSize = True
Picture1.AutoRedraw = True
drawicon Picture1.hdc, 0, 0, licon
Picture1.Refresh
End Sub

You stupid fool! ask your teacher for help.