当我们可以看到一个简单的 vb6 压缩 dll 时

when we can see an easy simble zipping dll for vb6

我用这样的代码做梦

声明函数 ZipFolder 库 "zipeasy.dll"

(SourceFolder,DistZipeName)
Private sub Command1_Click()
ZipFolder "C:\MyFolder\", "C:\MyZipdeFolder.zip")
End Sub

多年来我一直尝试这样做,但没有发生任何事情 所有类似的解决方案都非常复杂 为什么以及为什么以及为什么没有像我在这里建议的那样简单的解决方案?

您可以尝试 ZipArchive 项目 - A single-class pure VB6 library for zip with ASM speed

首先下载并添加 cZipArchive.cls 到您的 VB6 项目中,然后您就可以使用这个 ZipFolder 函数

Private Function ZipFolder( _
            SourceFolder As String, _
            DistZipeName As String, _
            Optional LastError As String) As Boolean
    On Error GoTo EH
    With New cZipArchive
        If Not .AddFromFolder(SourceFolder & IIf(Right$(SourceFolder, 1) <> "\", _
                "\", vbNullString) & "*.*", Recursive:=True) Then
            LastError = .LastError
            GoTo QH
        End If
        If Not .CompressArchive(DistZipeName) Then
            LastError = .LastError
            GoTo QH
        End If
    End With
    '--- success
    ZipFolder = True
QH:
    Exit Function
EH:
    LastError = Err.Description
    Resume QH
End Function

您当然可以用这个 class 做更多的事情(比如在 zip 中列出文件、提取文件、显示操作进度、仅压缩到内存、AES 加密级别)和您可以在 repo's root or in the source code of vbzip 命令行实用程序中的 README.md 中找到更多示例,这些示例可以 compress/extract zip 存档等

VbZip 0.2.3 (c) 2017-2018 by wqweto@gmail.com (12.1.2018 17:15:52)

Usage: vbzip.exe <command> [-options...] <archive_file> [files]...
e.g. vbzip.exe a backup.zip doc1.txt reports*.xls

Commands:
  a           add files to archive
  l           list archive contents
  t           test archive integrity
  x           extract files from archive

Options:
  -r          recurse subfolders
  -e          include empty folders
  -m LEVEL    compression level [default: 6]
  -o OUTPUT   output folder to extract to
  -i          no percentage indicator
  -y          assume yes to all questions
  -p PASSWORD password used to encrypt/decrypt files
  -mem METHOD encryption method
  -so         output to stdout
  -si NAME    input from stdin zip to NAME in archive