WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DllCall Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

DLLCall and CP5DLL32.DLL

Keywords: 

Question:

I am using a compression DLL from ELLTech, Inc. with WinBatch, and so far, I have been unable to receive the proper return value from the DLL. I am having trouble with the parameter calls based on the documentation. I was wondering if someone could decipher this "blurb" - so that it is functional with DLLCall.

Here is the Documentation on the function being called with DLLCall. Also - at the bottom, I include my code.

-------------------------------------------
Description

The Et5Init function is used to initialize Compression Plus. It returns a handle that must
be passed to most of the other routines. When your program is done with Compression
Plus, it must call Et5ShutDown to shut things down properly.

If this function fails, the handle is not valid, and you can't use Compression Plus. Failure
probably indicates an extreme lack of available memory.

C Syntax

short Et5Init ( LPCP5INFO * lpCP, long Reserved );

Delphi32 Syntax

Function Et5Init ( Var lpCP: LongInt; Reserved: LongInt ): SmallInt;

VB Syntax

Function Et5Init ( lpCP As Long, ByVal Reserved As Long ) As Integer
Parameters:
lpCP

On return, contains the Compression Plus handle.

Reserved

Reserved for future use. For now, must be set to zero.

(Result)

A status code. Zero is returned on success. A nonzero value is returned if there is an
error.

--------------------------------------------
Here is what I did...
        dllhandle=DllLoad("CP5DLL32.DLL")

        message("Did I get it?",dllhandle)

        a1=DLLCall(dllhandle,lpstr:"Et5Init",lpstr:"lpCP", long:0)
        DllFree(dllhandle)

Answer:

C Syntax:
        short Et5Init ( LPCP5INFO * lpCP, long Reserved );
Hmmm... A function Et5Init that returns a 16 bit WORD. It needs a pointer to a pointer where it can store a handle for the current transaction. And a reserved parameter.
        PTRBB=BinaryAlloc(4)
        BinaryEODSet(PTRBB,4)
        dllhandle=DllLoad("CP5DLL32.DLL")

        a1=DLLCall(dllhandle,WORD:"Et5Init",lpbinary:PTRBB, long:0)
        lpcp5info=BinaryPeek4(PTRBB,0)
        BinaryFree(PTRBB)

        ;;****Hereafter use long:lpcp5info in the rest of the Et5 functions than want it. 
        ;;****Usually the first parameter of the mess.


        DllFree(dllhandle)
I've seen this DLL before. It seems to work.
Article ID:   W12865
Filename:   DllCall to CP5DLL32 DLL.txt
File Created: 1999:04:15:16:50:10
Last Updated: 1999:04:15:16:50:10