Results 1 to 10 of 10

Thread: Zip API?

  1. #1

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211

    Zip API?

    i heard there was 1 but is there? an if so where can i find it?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I wrote to the WinZip support mail address asking for the same thing. They don't have anything directly, but they did give me two web sites to check out. They are:
    http://www.info-zip.org/pub/infozip/
    http://www.ctan.org/tex-archive/tools/zip/info-zip/

    I haven't checked these out yet. Let me know if you find anything cool.

  3. #3
    jim mcnamara
    Guest
    www.allapi.net has complete examples of using info-zip dll's.

    You can also use the command-line interface for WinZip
    by calling it with the VB Shell statement. It will compress/decompress files as well.

  4. #4
    Megatron
    Guest
    I don't think there are any Zip API's which are part of the standard Windows API library. You'll have to use routines from other DLLs.

  5. #5
    Lively Member
    Join Date
    Aug 2001
    Location
    Crossroads of America
    Posts
    72
    ME and XP OS's support unzipping, whereas all previous microsoft OS's do not. These two platforms almost certainly have some sort of DLL that controls the unzipping...but I haven't seen any documentation on it.

    If you're proficient at c++ programming, you can modify GNU source code to create a dll that can zip/unzip. I've done an uncompress dll for unix Z files, and I think that code is available for the zip compression format from GNU also.

  6. #6

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    i would use the shell thing but i dont know how to do it... could some one like give me a exaple because mine I THINK will shelll the program but it will not zip or unzip

  7. #7
    Megatron
    Guest
    I THINK will shelll the program but it will not zip or unzip
    Are you talking about PKZip? Just look at the documentation for it. It will tell you what command line arguments do what.

  8. #8
    Fanatic Member vb_dba's Avatar
    Join Date
    Jun 2001
    Location
    Somewhere aloft between the real world and insanity
    Posts
    1,016
    I created the following function to take care of it for me. It uses the CreateProcess API to call WinZip:
    VB Code:
    1. Public Declare Function CreateProcessA Lib "kernel32" (ByVal _
    2.    lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
    3.    lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
    4.    ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
    5.    ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
    6.    lpStartupInfo As STARTUPINFO, lpProcessInformation As _
    7.    PROCESS_INFORMATION) As Long
    8.  
    9. Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
    10.    hHandle As Long, ByVal dwMilliseconds As Long) As Long
    11.  
    12. Public Const NORMAL_PRIORITY_CLASS = &H20&
    13. Public Type STARTUPINFO
    14.    cb As Long
    15.    lpReserved As String
    16.    lpDesktop As String
    17.    lpTitle As String
    18.    dwX As Long
    19.    dwY As Long
    20.    dwXSize As Long
    21.    dwYSize As Long
    22.    dwXCountChars As Long
    23.    dwYCountChars As Long
    24.    dwFillAttribute As Long
    25.    dwFlags As Long
    26.    wShowWindow As Integer
    27.    cbReserved2 As Integer
    28.    lpReserved2 As Long
    29.    hStdInput As Long
    30.    hStdOutput As Long
    31.    hStdError As Long
    32. End Type
    33.  
    34. Public Type PROCESS_INFORMATION
    35.    hProcess As Long
    36.    hThread As Long
    37.    dwProcessID As Long
    38.    dwThreadID As Long
    39. End Type
    40.  
    41. Public Enum enSW
    42.     SW_HIDE = 0
    43.     SW_NORMAL = 1
    44.     SW_MAXIMIZE = 3
    45.     SW_MINIMIZE = 6
    46. End Enum
    47.  
    48. Public Sub ZipFiles()
    49. On Error GoTo errHandler
    50.     Dim id As Long
    51.     Dim WinZipStr As String
    52.     Dim ZipFile As String
    53.     Dim proc As PROCESS_INFORMATION
    54.     Dim start As STARTUPINFO
    55.     Dim ReturnValue As Integer
    56.    
    57.     ZipFile = CStr(Year(Date))
    58.     ZipFile = ZipFile & CStr(Month(Date))
    59.     ZipFile = ZipFile & CStr(Day(Date))
    60.    
    61.     WinZipStr = "C:\Program Files\WinZip\WinZip32 "
    62.     WinZipStr = WinZipStr & "-a " & InDir & "\Backup\" & ZipFile & ".zip "
    63.     WinZipStr = WinZipStr & InDir & "\*.dat"
    64.    
    65.     start.wShowWindow = enSW.SW_HIDE
    66.        
    67.     ReturnValue = CreateProcessA(0&, WinZipStr, 0&, 0&, 1&, _
    68.        NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
    69.  
    70.     ' Wait for the shelled application to finish:
    71.     Do
    72.        ReturnValue = WaitForSingleObject(proc.hProcess, 0)
    73.        DoEvents
    74.     Loop Until ReturnValue <> 258
    75.    
    76.     Exit Sub
    77. errHandler:
    78.     errCnt = errCnt + 1
    79.     errMsg = errMsg & "<TD>ZipFiles</TD>"
    80.     errMsg = errMsg & "<TD>" & Err.Description & "</TD>"
    81.     errMsg = errMsg & "<TD>" & CStr(Date) & " " & CStr(Time) & "</TD></TR><TR>"
    82.     WriteError (errMsg)
    83. End Sub

    InDir is just the path to the files that I want to zip. Check out www.allapi.net for info on the CreateProcess and WaitForSingleObject API call's.
    Chris

    Master Of My Domain
    Got A Question? Look Here First

  9. #9
    jim mcnamara
    Guest
    FWIW:

    If you go to the WinZip site, there is a command-line interface add-on. Download it and you can call WinZip from a command line, ie, use it from VB's Shell. As I remember it's wzcline.exe

  10. #10

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    ya that is what i was going to do is use the command line bbut i could never get the files to zip up

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width