Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problems with DECLARE command
Message
From
15/02/2003 09:15:36
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00753679
Message ID:
00753685
Views:
13
>Thanks Cetin
>
>The function is COMPRESS. The interface (in VB) is the following:
>
>Declare Function compress Lib "ZLIB.DLL" (ByVal compr As
> String, comprLen As Any, ByVal buf As String, ByVal buflen
> As Long) As Integer

Partial code from my own class :
PROCEDURE init
LOCAL lcPath
lcPath = ADDBS(JUSTPATH(this.ClassLibrary))
Declare integer compress in (lcPath+"zlib.dll") ;
	string @ dest, integer @ destLen, string @ src, integer srcLen
Declare integer compress2 in (lcPath+"zlib.dll") ;
	string @ dest, integer @ destLen, string @ src, integer srcLen, integer nLevel
Declare integer uncompress in (lcPath+"zlib.dll") ;
	string @ dest, integer @ destLen, string @ src, integer srcLen
ENDPROC

PROCEDURE destroy
CLEAR DLLS 'compress', 'uncompress'
ENDPROC


procedure CompressString
LPARAMETERS tcString
#define ZLIB_NOERROR 0
   this.nOriginalSize = Len(tcString)

   lnDestLen = CEILING(this.nOriginalSize * 1.02 + 12)
   lcBuffer = REPLICATE(CHR(0), lnDestLen)

   lnResult = compress2(@lcBuffer, @lnDestLen, @tcString, Len(tcString),9)

   If lnResult = ZLIB_NOERROR Then
      this.cCompressed = Left(lcBuffer, lnDestLen)
      this.nCompressedSize = lnDestLen
   ELSE
	  this.nCompressedSize = 0
   EndIf
   RETURN (lnResult = ZLIB_NOERROR)
EndProc
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform