{"id":21158704,"url":"https://github.com/wqweto/vszlib","last_synced_at":"2026-04-05T17:31:26.845Z","repository":{"id":3350416,"uuid":"4395424","full_name":"wqweto/VszLib","owner":"wqweto","description":"7-zip VB6 Helper","archived":false,"fork":false,"pushed_at":"2023-04-17T21:00:08.000Z","size":364,"stargazers_count":44,"open_issues_count":4,"forks_count":23,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-08T20:43:41.035Z","etag":null,"topics":["compression","lzma","seven-zip","vb6","zip"],"latest_commit_sha":null,"homepage":null,"language":"VBA","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wqweto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-05-21T15:59:10.000Z","updated_at":"2025-02-24T17:39:54.000Z","dependencies_parsed_at":"2022-09-01T02:01:25.100Z","dependency_job_id":null,"html_url":"https://github.com/wqweto/VszLib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqweto%2FVszLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqweto%2FVszLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqweto%2FVszLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wqweto%2FVszLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wqweto","download_url":"https://codeload.github.com/wqweto/VszLib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243602077,"owners_count":20317564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compression","lzma","seven-zip","vb6","zip"],"created_at":"2024-11-20T12:32:33.179Z","updated_at":"2025-12-29T17:23:41.859Z","avatar_url":"https://github.com/wqweto.png","language":"VBA","funding_links":[],"categories":[],"sub_categories":[],"readme":"## VszLib \r\n(Vsz = Vb Seven Zip)\r\n\r\n[7-zip SDK](http://www.7-zip.org/sdk.html) supports several compression methods that can produce and read 7z, zip, gzip, tar, bzip2 and other archives. This is a VB6 helper component that makes using original `7z.dll` in your VB6 projects possible. \r\n\r\n### Simple compress\r\n\r\n    With New cVszArchive\r\n        .AddFile \"your_file\"\r\n        .CompressArchive \"test.7z\"\r\n    End With\r\n\r\n### Extract\r\n\r\n    With New cVszArchive\r\n        .OpenArchive \"test.7z\"\r\n        .Extract \"extract_folder\"\r\n    End With\r\n\r\n### Create zip file with unicode filenames\r\n\r\n    With New cVszArchive\r\n        .AddFile \"your_file\"\r\n        '--- store filenames in UTF-8\r\n        .Parameter(\"cu\") = \"on\"\r\n        .CompressArchive \"archive.zip\"\r\n    End With\r\n\r\n### More options\r\n\r\n    With New cVszArchive\r\n        .AddFile \"your_file\"\r\n        .AddFile \"folder\\another_file\", \"folder\\name_in_archive\"\r\n        '--- fast compression (-mx3)\r\n        .Parameter(\"x\") = 3 \r\n        '--- LZMA2 method supports multi-core compression\r\n        .Parameter(\"0\") = \"LZMA2\"\r\n        .Parameter(\"mt\") = \"on\"\r\n        .Password = \"secret\"\r\n        '--- split in 10MB volumes\r\n        .VolumeSize = 10# * 1024 * 1024\r\n        .CompressArchive \"test_lzma2.7z\"\r\n    End With\r\n\t\r\n    With New cVszArchive\r\n        .OpenArchive \"source.7z\"\r\n        .Extract \"bin_folder\", \"*.exe\"\r\n    End With\r\n\r\n### Using source\r\n\r\nBefore opening `Src\\VszLib.vbp` register `Src\\SevenZip.tlb` with `regtlib.exe`, VB6 IDE or your favorite typelib registration tool. You don't need to redistribute `SevenZip.tlb`, it's only needed in development environment.\r\n\r\n### Using component\r\n\r\nRegister `Bin\\VszLib.dll` with `regsvr32.exe` (or VB6 IDE) and add a reference (Project | References...) in your project to *7-zip VB6 Helper 1.0*. You only need to redistribute `Bin\\VszLib.dll` with your application, `pdb` files are needed only for debugging purposes. Note that `Bin\\VszLib.dll` is compiled with line numbers in the source so that error logging can produce more useful traces.\r\n\r\n### API\r\n\r\nThe only publicly accessible class in the library is `cVszArchive`. Here is a short description of the methods, properties and events in order of relevance (kind of).\r\n\r\n#### `Init([DllFile As String]) As Boolean`\r\n\r\nOptionally used to indicate `7z.dll` location. If `DllFile` is empty first `7z.dll` is loaded from `VszLib.dll` folder, then registry is inspected for 7-zip setup folder, finally lightweight `7za.dll` is attempt loaded from `VszLib.dll` folder. Best practice is to place `7z.dll` next to `VszLib.dll` and to not call `Init` explicitly from client code. Extract/compress operation will call it if needed.\r\n\r\nNote that `7za.dll` (from [7-zip extras](http://sourceforge.net/projects/sevenzip/files/7-Zip/9.22/7z922_extra.7z/download)) can be used to compress/extract only 7z archives (no zip support). The even smaller `7zxa.dll` (172KB) can be used to only extract 7z archives.\r\n\r\n#### `OpenArchive(ArchiveFile As String) As Boolean`\r\n\r\nOpens the archive using archive file extension to guess decompressor type. Currently supported file extension for update: 7z, zip, tar, bz2, gz, xz, wim. Other formats supported: rar, cab, chm, iso, msi, hfs, iso, arj, cpio, deb, dmg, fat, flv, lzh, lzma, lzma86, mbr, ntfs, exe, pmd, rpm, 001, swf, vhd, xar, z. Populates `FileCount` and `FileInfo` properties. \r\n\r\n#### `Extract(TargetFolder As String, [Filter]) As Boolean`\r\n\r\nExtracts files to `TargetFolder` from a previously opened archive file. Optional `Filter` can specify which file entries to extract by exact match (`document.txt`), a filename mask (`*.exe`) or an array of `FileCount` booleans, each index indicating whether to decompress the file with same index (array entry set to `True`) or to skip it (array entry set to `False`). Raises `Progress` event to indicate progress and to allow cancellation of the extraction.\r\n\r\n#### `Property FileCount As Long` (read-only)\r\n\r\nReturns number of file entries in the archive\r\n\r\n#### `Property FileInfo(FileIdx As Long)` (read-only)\r\n\r\nReturns an array with information about a file entry. Array indexes are: 0 - file name, 1 - attributes, 2 - size, 3 - bool if encrypted, 4 - CRC, 5 - file comment, 6 - creation time, 7 - last access time, 8 - last write time. Some of the entries can be `Empty` if not supported by the current archive format.\r\n\r\n#### `AddFile(File As String, [Name As String], [Comment As String]) As Boolean`\r\n\r\nAdds a file to archive. `File` must be an (absolute) path to an existing file. Optional `Name` can specify name and relative folder in the archive the entry is going to be stored to. If `Name` not specified, filename portion of `File` is used as name in the root folder of the archive. `Comment` is optional and (probably) not supported by all compressors.\r\n\r\n#### `CompressArchive(ArchiveFile As String) As Boolean`\r\n\r\nCreates an archive using previously added files. Compressor type is guessed by archive file extension. Raises `Progress` event to indicate progress and to allow cancellation of the compression.\r\n\r\n#### `Property Parameter(ParamName As String) As Variant` (read/write)\r\n\r\nSpecifies custom compression parameters. These correspond to `-m` switch of command line `7z.exe`. \r\nSetting compression level switch `-mx3` or `-mx=3` is translated to `Parameter(\"x\") = 3`.\r\nSetting 7z compression method `-m0=LZMA2` is translated to `Parameter(\"0\") = \"LZMA2\"`.\r\nSetting multi-threading switch `-mmt=on` or `-mmt=3` is translated to `Parameter(\"mt\") = \"on\"` or `Parameter(\"mt\") = 3`.\r\nSetting encrypt headers switch `-mhe=on` is translated to `Parameter(\"he\") = \"on\"`. See [more examples of -m switch](http://www.dotnetperls.com/7-zip-examples) for additional info.\r\n\r\n#### `Property Password As String` (read/write)\r\n\r\nGets/sets password used during extraction/compression. If incorrect archive password is using, decompressor raises *Data Error. Wrong password?* error through `Error` event.\r\n\r\n#### `Property VolumeSize As Double` (read/write)\r\n\r\nGets/sets volume size in bytes for split volumes to be created during compression. Can be used with 7z archives only. For other formats splits output archive in `VolumeSize` sized chunks which is not supported model by native decompressors.\r\n\r\n#### `Property FormatCount As Long` (read-only)\r\n\r\nGets number of formats supported by `7z.dll` which has been loaded on `Init`.\r\n\r\n#### `Property FormatInfo(FormatIdx As Long) As Variant` (read-only)\r\n\r\nReturns an array with information about compression format. Array indexes are: 0 - name, 1 - class ID, 2 - file extension(s), 3 - additional extensions (if any), 4 - bool if update supported, 5 - bool if keeps names, 6 - byte array with archive start signature, 7 - byte array with archive finish signature.\r\n\r\n#### `Property LastError As String` (read-only)\r\n\r\nGets last error that occurred during last operation. Returns empty string if no error occurred.\r\n\r\n#### `Property PreserveDirectoryStructure As Boolean`\r\n\r\nGets/sets whether to preserve directory structure of archive under `TargetFolder` during extraction.\r\n\r\n#### `Event Progress(FileIdx As Long, Current As Double, Total As Double, Cancel As Boolean)`\r\n\r\nRaised when new information about current operation progress is available and to give the user a chance to cancel operation. `FileIdx` is the index of the current file being extracted/compressed. This index can be used with `FileInfo` property. `Current` and `Total` parameters can be using to calculate percentage completed. `Cancel` can be set to abort current operation. \r\n\r\n#### `Event Error(Description As String, Source As String, Cancel As Boolean)`\r\n\r\nRaised when an unexpected condition occurs during current operation. `Description` contains *User cancelled* when `Cancel` gets set in `Progress` event. `Description` contains *Data Error. Wrong password?* if wrong password is supplied for extraction of encrypted archives. Can be raised when input/output files are inaccessible (permissions, network outages). Setting `Cancel` indicates whether to finish operation or abort it immediately.\r\n\r\n#### `Event NewVolume(FileName As String)`\r\n\r\nRaised when creating multi-volume archives to indicate new file names that are created during compression. Useful if volumes are to be deleted on error or user cancellation.\r\n\r\n#### `BeforeExtract(ByVal FileIdx As Long, FileName As String, SkipFile As Boolean, Cancel As Boolean)`\r\n\r\nRaised before extracting a file from archive. `FileName` can be used to change target output filename on the fly. `SkipFile` can be used to selectively extract files based on logic that cannot be implemented with `Filter` argument of `Extract` method. `Cancel` can be set to abort further extraction. \r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwqweto%2Fvszlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwqweto%2Fvszlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwqweto%2Fvszlib/lists"}