Jump to content
Sign in to follow this  

dllcall problem

Recommended Posts

Hi all, I have several post in this forum but my email adress was cancel so I'm starting at zero post now.

I trying to use the funtions inside the dll attached and for wich I have also the .h header file. There are functions that are working fine because are very simple, but with this function call "xlOpenPort" I have only strange things:


;XLstatus xlOpenPort(
;   XlportHandle *portHandle,    ;it is LONG type (see header file) 
;   char *userName,
;   XLaccess accessMask,         ;XLaccess is uint64 type (see header file)
;   XLaccess *permissionMask,
;   unsigned int rxQueueSize,
;   unsigned int xlInterfaceVersion,
;   unsigned int busType)


Local $tport = DllStructCreate("LONG")

Local $tuser = DllStructCreate("String")
DllStructSetData($tuser, 1, "mynameapp")

Local $tpermisionmask = DllStructCreate("LONG")
DllStructSetData($tpermisionmask, 1, 0x001)

$result=DllCall($h_midll,"short","xlOpenPort", "ptr",$port, "Ptr",$user, "uint64",0x0001, "ptr",$permisionmask,"uint",1024,"uint",3,"uint",0x00000001)


If @error Then
    MsgBox($MB_SYSTEMMODAL, "", "Error in dllcall, Code: " & @error)
        Return False
MsgBox(0,"k","Port returned: "  & DllStructGetData($tport,1) & @crlf & " Result: "& $resultado[0])

Output parameter is only portHandle. 

The result[0] is 0, so the function has returned no errors, but in $port I have a -1. Wich I dont know if is a port  correct number.

And if I use:

MsgBox(0,"k","Port number: "  & DllStructGetData($tport,1) & @crlf & " Result: "& $result[0] & @CRLF & $result[1] & @CRLF & $result[2] & @CRLF & $result[3])

I get error:

Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

MsgBox(0,"k","Port number: "  & DllStructGetData($tport,1) & @crlf & " Result: "& $result[0] & @CRLF & $result[1] & @CRLF & $result[2] & @CRLF & $result[3])
MsgBox(0,"k","Port number: "  & DllStructGetData($tport,1) & @crlf & " Result: "& $result[0] & @CRLF & ^ ERROR

Do you see something wrong anyway?

Is the correct way to use DllCall with pointers parameters inside?

thanks in advance.



Share this post

Link to post
Share on other sites

The same: Blasa. My other email (hotmail) adress is out of service and I cant receive the new password because I dont remenber the old.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...