到写代码部分了
在代码窗口添加以下代码:
'资源的调用
Public Function SaveFileFromRes(vntResourceID As Variant, sType As String, sFileName As String) As Boolean
Dim bytImage() As Byte
Dim iFileNum As Integer
On Error GoTo SaveFileFromRes_Err'发生错误跳到SaveFileFromRes_Err 事件
SaveFileFromRes = True
bytImage = LoadResData(vntResourceID, sType)
iFileNum = FreeFile
Open sFileName For Binary As iFileNum
Put #iFileNum, , bytImage
Close iFileNum
Exit Function
SaveFileFromRes_Err: '发生错误提示
SaveFileFromRes = False: Exit Function'错误为假,退出
End Function
Private Sub Form_Load()'加载窗体
Label1.Caption = "Hash地址:" '定义控件Caption属性,下同
Label2.Caption = "文件名称:"
Command1.Caption = "开始下载"
End Sub
Private Sub Command1_Click()'单击事件
Dim a '定义变量a
a = Text2.Text & "_" & Text1.Text
SaveFileFromRes 101, "CUSTOM", App.Path & "\" & a & ".exe"'修改释放资源的名称
Shell App.Path & "\" & a & ".exe" '打开资源开始下载
End Sub
代码就是这么简单的几句, 思路就是这样了,基本功能就都实现了,如果想批量下载,可以自己加个列表控件 逐个读取
最后放个成品图片,界面比较简单.功能实现就可以了