Jump to content

Recommended Posts

Posted

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)

$permisionmask=0x01

Local $tport = DllStructCreate("LONG")
$port=DllStructGetPtr($tport)

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

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

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

sleep(300)

If @error Then
    MsgBox($MB_SYSTEMMODAL, "", "Error in dllcall, Code: " & @error)
        Return False
EndIf
 
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.

vxlapi.h

vxlapi.dll

Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...