I'm trying to interface the IBM ThinkPad's accelerometer chip into a VB app. After much googling, it seems that there is this sensor.dll that handles everything. I've been marginally successful at using it so far, and I was wondering if I could get some help. I've used DLLs in apps before, but with documentation, and since there is none on this one, it's been a challenge for me. Here's the details.....
I came across this page:
http://www.stanford.edu/~bsuter/thinkpad-accelerometer/
This guy has some code up (
http://www.stanford.edu/~bsuter/thin...ter/ApsDemo.cs) written for .NET that calls ShockproofGetAccelerometerData() in the DLL. I'd like to use that function in my app. So I have the following code in a module:
Code:
Private Declare Function ShockproofGetAccelerometerData Lib "sensor.dll" (ByRef AccelData As Long) As Long
Public Function GetAccelData(ByRef x As Long, ByRef y As Long) As Long
Dim data As Long
''''Debug.Print "spgad: " & ShockproofGetAccelerometerData(data)
ShockproofGetAccelerometerData data
Debug.Print "data: " & data
End Function
When this runs, VB keeps saying "Bad DLL calling convention." A minute ago, I was able to get it to put some values in data which I'm assuming were pointers to a structure.
Any ideas on how I should get started with this? Thanks.