Hi all,
I´m facing this problem with an Api function:
the function is something like this
in c++)
bool someFunction ( LPDest Dest, hFile HandleFile)
( translated to vb from c++)
public someFunction( ByRef DestinationPointer as Any, ByVal HandleToFile as long ) as boolean
the intendeed functionality according to the specification is as follow:
DestinationPointer: is a pointer to a structure ( or user defined type) that is filled by the function.
HandleToFile: handle to the file from where the data to fill the user defined type, is taken.
The function returns TRUE on success, False on error.
So what i´ve done so far is:
1- I create an UDT of the form
Public Type UDT
X as Double
Y as Double
Z as double
End Type
2- I create a reference to that UDT
Dim someUDT as UDT
3- Call the function as:
public someFunction( someUDT, HandleToFile ) as boolean
At this point all seems to work, exept that the values I get in someUDT.X , someUDT.Y and someUDT.Z makes no sense.
even more, if I run this function more than once, i get diferent results for every data.
And here is where i´m stocked.
I was reading various post related to using pointers in VB but I don´t understand how to apply it to this particular case.
So any help would be greatly appreciated.
I´m facing this problem with an Api function:
the function is something like this
bool someFunction ( LPDest Dest, hFile HandleFile)
( translated to vb from c++)
public someFunction( ByRef DestinationPointer as Any, ByVal HandleToFile as long ) as boolean
the intendeed functionality according to the specification is as follow:
DestinationPointer: is a pointer to a structure ( or user defined type) that is filled by the function.
HandleToFile: handle to the file from where the data to fill the user defined type, is taken.
The function returns TRUE on success, False on error.
So what i´ve done so far is:
1- I create an UDT of the form
Public Type UDT
X as Double
Y as Double
Z as double
End Type
2- I create a reference to that UDT
Dim someUDT as UDT
3- Call the function as:
public someFunction( someUDT, HandleToFile ) as boolean
At this point all seems to work, exept that the values I get in someUDT.X , someUDT.Y and someUDT.Z makes no sense.
even more, if I run this function more than once, i get diferent results for every data.
And here is where i´m stocked.
I was reading various post related to using pointers in VB but I don´t understand how to apply it to this particular case.
So any help would be greatly appreciated.