Hi

I found a simple solution for my problems with return "Type" from a DLL
call.

The problem was simply that I forgot that the Integer variable in VB maps to
a SmallInt in MB (and VB long --> MB Integer) ........ So when I changed my
declaration of the DLL function it worked!

Thanks to Lars Nielsen and Martin Higham for surgestions and moral backup on
this MapBasic "border land".

Regards

Thomas Brix Lyng
Frederikshavn Municipal Administration
Denmark




My original Mail:

'****************************************

Hi Mappers

I have a custom DLL I call from MapBasic. It returns some information as a
TYPE structure. I can't seem to get hold of the values set by the DLL call:

Example:

Type MyReturnInfo
        Attribute1 as String
        Attribute2 as Integer
        Attribute3 as String
End Type

Declare Function DllFunction Lib "A_DLL" (Byval ID as Integer, ReturnValues
as MyReturnInfo) as Integer

Declare Sub Main

Sub Main
        Dim ResOK as Integer
        Dim MyLoocalReturnValues as MyReturnInfo

        ResOK=DllFunction(12223,MyLoocalReturnValues)

        If ResOK=0 Then
                Print "Attribute1="+MyLoocalReturnValues.Attribute1
                Print "Attribute2="+Str$(MyLoocalReturnValues.Attribute2)
                Print "Attribute3="+MyLoocalReturnValues.Attribute3
        End If
End Sub

I can't get it to work so the question really is: Is MapBasic in anyway
capable in handling return values from DLLs if they are Type structures?

PS: When I declare the DLL as ......MyReturnInfo as STRING...... I do get an
attribute, but only the first (Attribute1)!


Please adwice, Its really bugging me!

'****************************************


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 10523

Reply via email to