⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vbunzip.bas

📁 完整的解压zip文件的源码。包含密码功能
💻 BAS
📖 第 1 页 / 共 2 页
字号:
Attribute VB_Name = "VBUnzBas"Option Explicit'-- Please Do Not Remove These Comment Lines!'----------------------------------------------------------------'-- Sample VB 5 code to drive unzip32.dll'-- Contributed to the Info-ZIP project by Mike Le Voi'--'-- Contact me at: mlevoi@modemss.brisnet.org.au'--'-- Visit my home page at: http://modemss.brisnet.org.au/~mlevoi'--'-- Use this code at your own risk. Nothing implied or warranted'-- to work on your machine :-)'----------------------------------------------------------------'--'-- This Source Code Is Freely Available From The Info-ZIP Project'-- Web Server At:'-- http://www.cdrom.com/pub/infozip/infozip.html'--'-- A Very Special Thanks To Mr. Mike Le Voi'-- And Mr. Mike White'-- And The Fine People Of The Info-ZIP Group'-- For Letting Me Use And Modify Their Orginal'-- Visual Basic 5.0 Code! Thank You Mike Le Voi.'-- For Your Hard Work In Helping Me Get This To Work!!!'---------------------------------------------------------------'--'-- Contributed To The Info-ZIP Project By Raymond L. King.'-- Modified June 21, 1998'-- By Raymond L. King'-- Custom Software Designers'--'-- Contact Me At: king@ntplx.net'-- ICQ 434355'-- Or Visit Our Home Page At: http://www.ntplx.net/~king'--'---------------------------------------------------------------'--'-- Modified August 17, 1998'-- by Christian Spieler'-- (implemented sort of a "real" user interface)'--'---------------------------------------------------------------'-- C Style argvPrivate Type UNZIPnames  uzFiles(0 To 99) As StringEnd Type'-- Callback Large "String"Private Type UNZIPCBChar  ch(32800) As ByteEnd Type'-- Callback Small "String"Private Type UNZIPCBCh  ch(256) As ByteEnd Type'-- UNZIP32.DLL DCL StructurePrivate Type DCLIST  ExtractOnlyNewer  As Long    ' 1 = Extract Only Newer, Else 0  SpaceToUnderscore As Long    ' 1 = Convert Space To Underscore, Else 0  PromptToOverwrite As Long    ' 1 = Prompt To Overwrite Required, Else 0  fQuiet            As Long    ' 2 = No Messages, 1 = Less, 0 = All  ncflag            As Long    ' 1 = Write To Stdout, Else 0  ntflag            As Long    ' 1 = Test Zip File, Else 0  nvflag            As Long    ' 0 = Extract, 1 = List Zip Contents  nUflag            As Long    ' 1 = Extract Only Newer, Else 0  nzflag            As Long    ' 1 = Display Zip File Comment, Else 0  ndflag            As Long    ' 1 = Honor Directories, Else 0  noflag            As Long    ' 1 = Overwrite Files, Else 0  naflag            As Long    ' 1 = Convert CR To CRLF, Else 0  nZIflag           As Long    ' 1 = Zip Info Verbose, Else 0  C_flag            As Long    ' 1 = Case Insensitivity, 0 = Case Sensitivity  fPrivilege        As Long    ' 1 = ACL, 2 = Privileges  Zip               As String  ' The Zip Filename To Extract Files  ExtractDir        As String  ' The Extraction Directory, NULL If Extracting To Current DirEnd Type'-- UNZIP32.DLL Userfunctions StructurePrivate Type USERFUNCTION  UZDLLPrnt     As Long     ' Pointer To Apps Print Function  UZDLLSND      As Long     ' Pointer To Apps Sound Function  UZDLLREPLACE  As Long     ' Pointer To Apps Replace Function  UZDLLPASSWORD As Long     ' Pointer To Apps Password Function  UZDLLMESSAGE  As Long     ' Pointer To Apps Message Function  UZDLLSERVICE  As Long     ' Pointer To Apps Service Function (Not Coded!)  TotalSizeComp As Long     ' Total Size Of Zip Archive  TotalSize     As Long     ' Total Size Of All Files In Archive  CompFactor    As Long     ' Compression Factor  NumMembers    As Long     ' Total Number Of All Files In The Archive  cchComment    As Integer  ' Flag If Archive Has A Comment!End Type'-- UNZIP32.DLL Version StructurePrivate Type UZPVER  structlen       As Long         ' Length Of The Structure Being Passed  flag            As Long         ' Bit 0: is_beta  bit 1: uses_zlib  beta            As String * 10  ' e.g., "g BETA" or ""  date            As String * 20  ' e.g., "4 Sep 95" (beta) or "4 September 1995"  zlib            As String * 10  ' e.g., "1.0.5" or NULL  unzip(1 To 4)   As Byte         ' Version Type Unzip  zipinfo(1 To 4) As Byte         ' Version Type Zip Info  os2dll          As Long         ' Version Type OS2 DLL  windll(1 To 4)  As Byte         ' Version Type Windows DLLEnd Type'-- This Assumes UNZIP32.DLL Is In Your \Windows\System Directory!Private Declare Function Wiz_SingleEntryUnzip Lib "unzip32.dll" _  (ByVal ifnc As Long, ByRef ifnv As UNZIPnames, _   ByVal xfnc As Long, ByRef xfnv As UNZIPnames, _   dcll As DCLIST, Userf As USERFUNCTION) As LongPrivate Declare Sub UzpVersion2 Lib "unzip32.dll" (uzpv As UZPVER)'-- Private Variables For Structure AccessPrivate UZDCL  As DCLISTPrivate UZUSER As USERFUNCTIONPrivate UZVER  As UZPVER'-- Public Variables For Setting The'-- UNZIP32.DLL DCLIST Structure'-- These Must Be Set Before The Actual Call To VBUnZip32Public uExtractNewer     As Integer  ' 1 = Extract Only Newer, Else 0Public uSpaceUnderScore  As Integer  ' 1 = Convert Space To Underscore, Else 0Public uPromptOverWrite  As Integer  ' 1 = Prompt To Overwrite Required, Else 0Public uQuiet            As Integer  ' 2 = No Messages, 1 = Less, 0 = AllPublic uWriteStdOut      As Integer  ' 1 = Write To Stdout, Else 0Public uTestZip          As Integer  ' 1 = Test Zip File, Else 0Public uExtractList      As Integer  ' 0 = Extract, 1 = List ContentsPublic uExtractOnlyNewer As Integer  ' 1 = Extract Only Newer, Else 0Public uDisplayComment   As Integer  ' 1 = Display Zip File Comment, Else 0Public uHonorDirectories As Integer  ' 1 = Honor Directories, Else 0Public uOverWriteFiles   As Integer  ' 1 = Overwrite Files, Else 0Public uConvertCR_CRLF   As Integer  ' 1 = Convert CR To CRLF, Else 0Public uVerbose          As Integer  ' 1 = Zip Info VerbosePublic uCaseSensitivity  As Integer  ' 1 = Case Insensitivity, 0 = Case SensitivityPublic uPrivilege        As Integer  ' 1 = ACL, 2 = Privileges, Else 0Public uZipFileName      As String   ' The Zip File NamePublic uExtractDir       As String   ' Extraction Directory, Null If Current Directory'-- Public Program VariablesPublic uZipNumber    As Long         ' Zip File NumberPublic uNumberFiles  As Long         ' Number Of FilesPublic uNumberXFiles As Long         ' Number Of Extracted FilesPublic uZipMessage   As String       ' For Zip MessagePublic uZipInfo      As String       ' For Zip InformationPublic uZipNames     As UNZIPnames   ' Names Of Files To UnzipPublic uExcludeNames As UNZIPnames   ' Names Of Zip Files To ExcludePublic uVbSkip       As Integer      ' For DLL Password Function'-- Puts A Function Pointer In A Structure'-- For Callbacks.Public Function FnPtr(ByVal lp As Long) As Long  FnPtr = lpEnd Function'-- Callback For UNZIP32.DLL - Receive Message FunctionPublic Sub UZReceiveDLLMessage(ByVal ucsize As Long, _    ByVal csiz As Long, _    ByVal cfactor As Integer, _    ByVal mo As Integer, _    ByVal dy As Integer, _    ByVal yr As Integer, _    ByVal hh As Integer, _    ByVal mm As Integer, _    ByVal c As Byte, ByRef fname As UNZIPCBCh, _    ByRef meth As UNZIPCBCh, ByVal crc As Long, _    ByVal fCrypt As Byte)  Dim s0     As String  Dim xx     As Long  Dim strout As String * 80  '-- Always Put This In Callback Routines!  On Error Resume Next  '------------------------------------------------  '-- This Is Where The Received Messages Are  '-- Printed Out And Displayed.  '-- You Can Modify Below!  '------------------------------------------------  strout = Space(80)  '-- For Zip Message Printing  If uZipNumber = 0 Then    Mid(strout, 1, 50) = "Filename:"    Mid(strout, 53, 4) = "Size"    Mid(strout, 62, 4) = "Date"    Mid(strout, 71, 4) = "Time"    uZipMessage = strout & vbNewLine    strout = Space(80)  End If  s0 = ""  '-- Do Not Change This For Next!!!  For xx = 0 To 255    If fname.ch(xx) = 0 Then Exit For    s0 = s0 & Chr(fname.ch(xx))  Next  '-- Assign Zip Information For Printing  Mid(strout, 1, 50) = Mid(s0, 1, 50)  Mid(strout, 51, 7) = Right("        " & Str(ucsize), 7)  Mid(strout, 60, 3) = Right("0" & Trim(Str(mo)), 2) & "/"  Mid(strout, 63, 3) = Right("0" & Trim(Str(dy)), 2) & "/"  Mid(strout, 66, 2) = Right("0" & Trim(Str(yr)), 2)  Mid(strout, 70, 3) = Right(Str(hh), 2) & ":"  Mid(strout, 73, 2) = Right("0" & Trim(Str(mm)), 2)  ' Mid(strout, 75, 2) = Right(" " & Str(cfactor), 2)  ' Mid(strout, 78, 8) = Right("        " & Str(csiz), 8)  ' s0 = ""  ' For xx = 0 To 255  '     If meth.ch(xx) = 0 Then exit for  '     s0 = s0 & Chr(meth.ch(xx))  ' Next xx  '-- Do Not Modify Below!!!  uZipMessage = uZipMessage & strout & vbNewLine  uZipNumber = uZipNumber + 1End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -