1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
See below some functions declarations for Visual Basic.
Frequently Asked Question:
Q: Each time I use the compress function I get the -5 error (not enough
room in the output buffer).
A: Make sure that the length of the compressed buffer is passed by
reference ("as any"), not by value ("as long"). Also check that
before the call of compress this length is equal to the total size of
the compressed buffer and not zero.
From: "Jon Caruana" <jon-net@usa.net>
Subject: Re: How to port zlib declares to vb?
Date: Mon, 28 Oct 1996 18:33:03 -0600
Got the answer! (I haven't had time to check this but it's what I got, and
looks correct):
He has the following routines working:
compress
uncompress
gzopen
gzwrite
gzread
gzclose
Declares follow: (Quoted from Carlos Rios <c_rios@sonda.cl>, in Vb4 form)
#If Win16 Then 'Use Win16 calls.
Declare Function compress Lib "ZLIB.DLL" (ByVal compr As
String, comprLen As Any, ByVal buf As String, ByVal buflen
As Long) As Integer
Declare Function uncompress Lib "ZLIB.DLL" (ByVal uncompr
As String, uncomprLen As Any, ByVal compr As String, ByVal
lcompr As Long) As Integer
Declare Function gzopen Lib "ZLIB.DLL" (ByVal filePath As
String, ByVal mode As String) As Long
Declare Function gzread Lib "ZLIB.DLL" (ByVal file As
Long, ByVal uncompr As String, ByVal uncomprLen As Integer)
As Integer
Declare Function gzwrite Lib "ZLIB.DLL" (ByVal file As
Long, ByVal uncompr As String, ByVal uncomprLen As Integer)
As Integer
Declare Function gzclose Lib "ZLIB.DLL" (ByVal file As
Long) As Integer
#Else
Declare Function compress Lib "ZLIB32.DLL"
(ByVal compr As String, comprLen As Any, ByVal buf As
String, ByVal buflen As Long) As Integer
Declare Function uncompress Lib "ZLIB32.DLL"
(ByVal uncompr As String, uncomprLen As Any, ByVal compr As
String, ByVal lcompr As Long) As Long
Declare Function gzopen Lib "ZLIB32.DLL"
(ByVal file As String, ByVal mode As String) As Long
Declare Function gzread Lib "ZLIB32.DLL"
(ByVal file As Long, ByVal uncompr As String, ByVal
uncomprLen As Long) As Long
Declare Function gzwrite Lib "ZLIB32.DLL"
(ByVal file As Long, ByVal uncompr As String, ByVal
uncomprLen As Long) As Long
Declare Function gzclose Lib "ZLIB32.DLL"
(ByVal file As Long) As Long
#End If
-Jon Caruana
jon-net@usa.net
Microsoft Sitebuilder Network Level 1 Member - HTML Writer's Guild Member
|