Help with input device

Blitz3D Forums/Blitz3D Userlibs/Help with input device

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm trying to read a USB device that allows me to test rotary encoders. The device enumerates as a standard HID controller although not as joystick or mouse etc... I have a .dll from the manufacturer and have placed it in the userlibs dir. I have also created a .decls file which looks like this:

.lib "spinkit.dll"

SpinKitOpenDevice%():"SpinKitOpenDevice"
SpinKitCloseDevice% (devHandle%):"SpinKitCloseDevice"
SpinKitRead%(devHandle%,SpinData*):"SpinKitRead"
SpinKitReadImmediate%(devHandle%,SpinData*):"SpinKitReadImmediate"
SpinKitGetNumDevs%():"SpinKitGetNumDevs"
SpinKitGetDeviceHandle%(numDevice%):"SpinKitGetDeviceHandle"
SpinKitGetProductId%(devHandle%):"SpinKitGetProductId"
SpinKitGetRevision%(devHandle%):"SpinKitGetRevision"
SpinKitGetThreadHandle%(devHandle%):"SpinKitGetThreadHandle"
SpinKitGetSerialNumber%(devHandle%):"SpinKitGetSerialNumber"
SpinKitSetTimeout(devHandle%,timeout%):"SpinKitSetTimeout"
SpinKitVersion%():"SpinKitVersion"

All of the functions seem to work fine except I cant seem to figure out how to use SpinKitRead%(devHandle%,SpinData*) and SpinKitReadImmediate%(devHandle%,SpinData*).

I'm sort of familliar with using a bank to point the data to as in GetCursorPos from user32.dll but it doesn't seem to work the same way.

In the documentation for the device they give a data structure that looks like this:

typedef struct _SPINKIT_DATA
{
SPINKIT_HANDLE Device;
int Spins[6]
BOOL Buttons[7]
}
SPINKIT_DATA, *PSPINKIT_DATA;

I was also provided with a working example app with source code which runs fine but it is written in Delphi and I am not familliar with the syntax.

It should be fairly straight foreward retrieve the data in Blitz and the SpinKitGetDeviceHandle%(numDevice%) function works fine but SpinKitRead%(devHandle%,SpinData*) returns zero when it should be nonzero and there is no data in the bank.

Any help would be greatly appreciated.

Thanks!