Michael C said:
First, it is possible to call non-stdcall functions in VB6. If you require
I have some code that will do this.
BUT, you don't need to do this. If you're getting away with calling one
single function without an error then they are using stdcall and it should
be compatible with vb6. You're likely just misreading the C++ code. It
sounds to me like you're making an error when retrieving data from the
port. How are you calling that particular function?
Okay, see the code at the bottom. I obscured some of the real variable names
etc., because I don't think I am allowed to share the exact code. I hope I
didn't make any typos while doing that.
I tried it in vb.net by the way (as Mr. Wagner suggested) and it works like
a charm. But I got a quite large app I am working on in VB6 from which it
should be a part of, so I am sill interested in your code.
In the function call in Command5_Click is returning true, but the values in
the debug. prints are all worng!
Module code:
Type XYZFILE
iSize As Integer
iTime As Integer
iDate As Integer
iDuration As Integer
bUSTimeMode As Boolean
iSamplingRate As Integer
bRRRecording As Boolean
bDeleted As Boolean
bSpeed As Boolean
bCadence As Boolean
bAltitude As Boolean
bPower As Boolean
bInterval As Boolean
szName As String * 11
iBike As Integer
iExerciseID As Integer
End Type
Declare Function fnCom_GetFileInfo _
Lib "xyzcom.dll" _
Alias "_fnCom_GetFileInfo@8" (ByVal iExercise As Integer, _
ByRef Exercise As XYZFILE) As Boolean
Form code:
Option Explicit
Private Sub Command5_Click()
Dim FileNummmer As Integer
Dim pef As XYZFILE
FileNummmer = 0
If fnCom_GetFileInfo(FileNummmer, pef) Then
Debug.Print
Debug.Print pef.bInterval
Debug.Print pef.bUSTimeMode
Debug.Print pef.iDate
Debug.Print pef.iTime
Debug.Print pef.iDuration
Debug.Print pef.iSamplingRate
Debug.Print pef.szName
MsgBox "File " & FileNummmer & " read!"
Else
MsgBox "Unable to read file!"
End If
End Sub
Thanks, Bas