|
-
Dec 20th, 2001, 10:29 AM
#1
Thread Starter
Frenzied Member
Zip API?
i heard there was 1 but is there? an if so where can i find it?
-
Dec 20th, 2001, 10:52 AM
#2
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.
-
Dec 20th, 2001, 11:43 AM
#3
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.
-
Dec 20th, 2001, 04:41 PM
#4
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.
-
Dec 21st, 2001, 09:50 AM
#5
Lively Member
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.
-
Jan 3rd, 2002, 12:38 PM
#6
Thread Starter
Frenzied Member
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
-
Jan 3rd, 2002, 04:13 PM
#7
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.
-
Jan 3rd, 2002, 04:37 PM
#8
Fanatic Member
I created the following function to take care of it for me. It uses the CreateProcess API to call WinZip:
VB Code:
Public Declare Function CreateProcessA Lib "kernel32" (ByVal _
lpApplicationName As Long, ByVal lpCommandLine As String, ByVal _
lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _
lpStartupInfo As STARTUPINFO, lpProcessInformation As _
PROCESS_INFORMATION) As Long
Public Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
hHandle As Long, ByVal dwMilliseconds As Long) As Long
Public Const NORMAL_PRIORITY_CLASS = &H20&
Public Type STARTUPINFO
cb As Long
lpReserved As String
lpDesktop As String
lpTitle As String
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
Public Enum enSW
SW_HIDE = 0
SW_NORMAL = 1
SW_MAXIMIZE = 3
SW_MINIMIZE = 6
End Enum
Public Sub ZipFiles()
On Error GoTo errHandler
Dim id As Long
Dim WinZipStr As String
Dim ZipFile As String
Dim proc As PROCESS_INFORMATION
Dim start As STARTUPINFO
Dim ReturnValue As Integer
ZipFile = CStr(Year(Date))
ZipFile = ZipFile & CStr(Month(Date))
ZipFile = ZipFile & CStr(Day(Date))
WinZipStr = "C:\Program Files\WinZip\WinZip32 "
WinZipStr = WinZipStr & "-a " & InDir & "\Backup\" & ZipFile & ".zip "
WinZipStr = WinZipStr & InDir & "\*.dat"
start.wShowWindow = enSW.SW_HIDE
ReturnValue = CreateProcessA(0&, WinZipStr, 0&, 0&, 1&, _
NORMAL_PRIORITY_CLASS, 0&, 0&, start, proc)
' Wait for the shelled application to finish:
Do
ReturnValue = WaitForSingleObject(proc.hProcess, 0)
DoEvents
Loop Until ReturnValue <> 258
Exit Sub
errHandler:
errCnt = errCnt + 1
errMsg = errMsg & "<TD>ZipFiles</TD>"
errMsg = errMsg & "<TD>" & Err.Description & "</TD>"
errMsg = errMsg & "<TD>" & CStr(Date) & " " & CStr(Time) & "</TD></TR><TR>"
WriteError (errMsg)
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
-
Jan 3rd, 2002, 04:40 PM
#9
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
-
Jan 4th, 2002, 03:59 AM
#10
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|