Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing MagTek IPAD via DLL

Status
Not open for further replies.

cthode

Programmer
Feb 24, 2011
3
US
The problem I have is accessing the DLL's which use reference BYTE parameters (BYTE @). The original code that I have is in VB, and below is my conversion to VFP. When I call the MTIPADSendAmount() function, I get a Program Error - "Too many arguments."

*!* Dim ResultCode As Long
*!* Dim OperationStatus As Byte
*!* Dim Amount As String
*!*
*!* Amount = "20.15"
*!* ResultCode = MTIPADSendAmount(Amount, OperationStatus)

DECLARE LONG MTIPADOpen IN "MTIPADLIB.dll"

DECLARE LONG MTIPADIsLibReady IN "MTIPADLIB.dll"

DECLARE LONG MTIPADSendAmount IN "MTIPADLIB.dll" ;
STRING Amount , BYTE @OpStatus


ResultCode = MTIPADOpen()

ResultCode = MTIPADIsLibReady()

lcBuff = REPLICATE(CHR(0),16)
Amount = "20.14"
ResultCode = MTIPadSendAmount(Amount,@lcBuff)

? ResultCode

Is there a better way to call the DECLARE, or is anyone using a different way to access the MagTek IPAD other than DLL?

Any info or suggestions would be appreciated!

thanks!
Carsten
 
Regarding your DECLARE:

Code:
DECLARE LONG MTIPADSendAmount IN "MTIPADLIB.dll" ;
STRING Amount , BYTE @OpStatus

I didn't know you can declare a parameter as a BYTE. Given that it will hold 16 characters, I would have thought it needs to be a sting. In other words:

Code:
DECLARE LONG MTIPADSendAmount IN "MTIPADLIB.dll" ;
STRING Amount , [b]STRING[/b] @OpStatus

But I'm not sure. Worth a try.

By the way, the error message you saw is notoriously misleading. It's not the number of arguments that's the problem, but rather their data types.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
> Dim OperationStatus As Byte
A Byte is a Byte, a single Byte, not 16 Bytes.

What's missing from your VB Code is the Declare Function MTIPADSendAmount Lib MTIPADLIB.dll (...) declaration, to see how that would need to be translated to VFP DECLARE DLL.

A ByRef OperationStatus As Byte should translate to a String @OperationStatus with OperationStatus=CHR(value) and value between 0 and 255 of course.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top