7,765
社区成员
发帖
与我相关
我的任务
分享
Dim TempFile() As Byte
Dim FileNum As Integer
TempFile = LoadResData(101, "CUSTOM")
FileNum = FreeFile
Open "d:\123.rar" For Binary Access Write As #FileNum '文件名和路径自己随便改
Put #FileNum, , TempFile
Close #FileNum
Dim fname As String
Private Sub command1_click()
Dim v
Dim byt() As Byte
fname="c:\wang\123.rar"
If Dir(fname)="" Then
v=LoadResData(101,"CUSTOM")
byt=v
Open fname For Binary As #1
Put #1,1,byt()
Close #1
End If
End Sub
Private Sub Command1_Click()
CommonDialog1.ShowSave
End Sub
'此为我写URLDownload下载文件程序保存sub
Private Sub Command4_Click()
On Error Resume Next
Dim aa As String
Dim n As Integer
aa = Text1.Text 'text1是输入网址的地方
n = InStr(aa, "/") '找到字串中带"\"或带"/"的地方
If n = 0 Then
aa = Right(aa, InStr(StrReverse(aa), "\") - 1)'取"\"后的字串,即文件名
ElseIf n <> 0 And n > 0 Then
aa = Right(aa, InStr(StrReverse(aa), "/") - 1)'取"/"后的字串,即文件名
End If
With CommonDialog1 '调出保存的对话框
.DialogTitle = "保存文件"
.FileName = aa '此时的aa已经是文件名,而不是完整路径
.Filter = "All files|*.*"
.ShowSave
End With
Text2.Text = CommonDialog1.FileName '完整路径
End Sub