Code
Public Function UnzipPK_MM(Val() As Byte, Password As String, ZipControl As Zip, ByRef Status() As Variant) As Byte()
'Purpose
'   Used to decompress a value and return the result.
'Parameters
'   Val (Byte()) = The value we want to decompress.
'   Password (String) = A password used to decrypt the value.
'       A password is not used to decode the value if it is zero-length.
'   ZipControl (Zip) = A reference to the Dart Zip control we're going to use for decompression.
'   Status (Variant()) = A standard rtStatus array. This is used to return status information.
'       Returned status values are taken directly from the Dart Zip control and DartStream objects.
'       Status conditions are reported in the first two elements only. Any additional elements are unchanged.
'       This must enter with two or more elements (zero-based) or function may crash.
'Return (Byte())
'   Returns the specified value uncompressed.
'   If an error occurs, returns an empty Byte array.
'Exit Conditions
'   The FileStore object of the specified Zip control is altered.
'Dependencies
'   The Dart "Zip" control must be referenced in the hosting application.
'Version History
'   1.0 7/4/2004 Tested by Russ Tanner
'---

'Set status trap
On Error GoTo UnzipPK_MM_Error:

'Initiate variables
Dim StreamIn As New DartStream 'we need 2 separate streams here
Dim StreamOut As New DartStream
Dim EmptyByteArray() As Byte

'Clear the status condition
Status(0) = CLng(0)
Status(1) = ""

'Remove all previous files from the FileStore
ZipControl.FileStore.Clear

'Load the specified value to the FileStore
StreamIn.Write Val
ZipControl.FileStore.Load StreamIn

'Unzip the value. Use a password only if it is specified.
If Password = "" Then
    ZipControl.FileStore(1).Extract StreamOut
Else
    ZipControl.FileStore(1).Extract StreamOut, Password
End If

'Remove all previous files from the FileStore
ZipControl.FileStore.Clear

'Return the result
StreamOut.Position = 0 'Must rewind the stream to read from it
UnzipPK_MM = StreamOut.ReadBytes 'Return the uncompressed value

Exit Function

'Error Trap
UnzipPK_MM_Error:

'An error occured, return an empty Byte array
UnzipPK_MM = EmptyByteArray

'Remove all previous files from the FileStore
ZipControl.FileStore.Clear

'Return the error information
Status(0) = Err.Number
Status(1) = Err.Description

End Function


The Captian
Today they call you "crazy". Tomorrow they call you "ahead of your time."
Global Skywatch Learn about Chemtrails - You're breathing them now!
OnlyTheBestHerbs.com World-class supplements
Mercury Talk Why you are sick.
OneUp Domains Domains, Hosting, Email
1-800-358-4278 (U.S. & Canada)