我对发展中国家相当陌生。我在我的工作中使用vb6,目前正在尝试压缩包含多个文件的特定文件夹。这可能不使用任何第三方程序吗?
到目前为止,我找到的所有材料都只是压缩一个文件。
谢谢:)
答案 0 :(得分:0)
看起来Folder.CopyHere会有所帮助。但是,当副本完成时,它不会通知程序。
Dim s As String
s = "C:\FullPathToZipFile"
'create a new zip file
Open s For Binary As #1
Dim zipd
zipd = Array(80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
Dim zip(21) As Byte
Dim i As Long
For i = 0 To 21
zip(i) = zipd(i)
Next
Put #1, , zip
Close #1
Dim objShell As Object
Set objShell = CreateObject("Shell.Application")
Dim objZip As Object, objFolder As Object
Set objZip = objShell.NameSpace(s)
If Not objZip Is Nothing Then
Set objFolder = objShell.NameSpace("C:\FullPathToYourFiles")
If Not objFolder Is Nothing Then
objZip.CopyHere objFolder.Items
End If
End If
或者(也许)您可以实施Compression API