How to convert DLL-Api Call to Xojo

Hello everone! Happy New Year!

I must read a magnetcard with a prehtec-Keyboard. I got this from prehtec:

3.8 Read USB MSR data

Description: Read out MSR data. The function return immediately, if MSR data was already stored.
Otherwise the DLL waits dwTime milliseconds for MSR data. If no card is swiped within time dwTime
the return value is 15 (no data during time out time).

Function: unsigned char read_MSR_data_USB(char ucpData1,int dwLen1,
char
ucpData2,int dwLen2,
char*ucpData3,int dwLen3,
DWORD dwTime)

Parameters:

char *ucpData1 Pointer to track 1 data buffer.
int dwLen1 Length of track 1 data buffer-
char *ucpData2 Pointer to track 2 data buffer.
int dwLen2 Length of track 2 data buffer-
char *ucpData3 Pointer to track 3 data buffer.
int dwLen3 Length of track 3 data buffer-
DWORD dwTime Timeout time in ms

Return values:

0 = success
1 = USB Device was not opened
2 = no buffer for track 1
3 = no buffer for track 2
4 = no buffer for track 3
5 = dwTime is zero or undefined
6 = USB device initialisation error
7 = could not install timeout timer
8 = timeout timer not running
9 = track 1 buffer not sufficient for track 1 data
10 = internal communication error with track 1 data
11 = track 1 buffer not sufficient for track 2 data
12 = internal communication error with track 2 data
13 = track 1 buffer not sufficient for track 3 data
14 = internal communication error with track 3 data
15 = no data during timeout time

How to convert this to xojo-syntax?

Soft Declare Function read_MSR_data_USB Lib “MwxUSB.dll” (???) As Integer

I need the information from track1 and track2.

Thanks for your help.

Frank

Soft Declare function read_MSR_data_USB Lib "MwxUSB.dll" (ucpData1 as CString, dwLen1 as Integer, ucpData2 as CString, dwLen2 as Integer, ucpData3 as CString, dwLen3 as Integer, dwTime as UInt32) as Integer

Off the top of my head. This is assuming that the dll is ansi.

[code]Dim ucpData1 As New MemoryBlock(256)
Dim ucpData2 As New MemoryBlock(256)
Dim ucpData3 As New MemoryBlock(256)

Dim v As UInt8
dim t As UInt32

Soft Declare Function read_MSR_data_USB Lib “MwxUSB.dll” (ucpData1 As Ptr, dwLen1 As Int32, ucpData2 As Ptr, dwLen2 As Int32, ucpData3 As Ptr, dwLen3 As Int32, dwTime As UInt32) As UInt8

v = read_MSR_data_USB(ucpData1, ucpData1.Size, ucpData2, ucpData2.Size, ucpData3, ucpData3.Size, t)

System.DebugLog(ucpData1.CString(0))
System.DebugLog(ucpData2.CString(0))
System.DebugLog(ucpData3.CString(0))[/code]

See https://blog./2017/01/22/windows-to-xojo-data-type-conversion/ for assistance.

Thanks! That was the solution!

Frank