Pass UDT as IntPtr

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is a VB.net 2003 question

I have a function called HandleES that expects a "ByVal lpES As IntPtr" paramter in My1.DLL

I would like to call the function from My2.DLL. In My2.DLL I've created the UDT

structure E
dim i as intege
dim j as intege
.... ..
end structur

dim MyES as E
ES.Initialize(

dim x as Intege
x = HandleES(... MyES ...

With function HandleES expecting lpES as IntPtr, how do I pass the address of a MyES in My2.DLL to my function in My1.DLL that takes the pointer to the UDT as a IntPtr

Thank you
 
Bob,
With function HandleES expecting lpES as IntPtr, how do I pass the address of a MyES in My2.DLL to my function in My1.DLL that takes the pointer to the UDT as a IntPtr?

The easiest way would be to change the parameter type to ByRef As ES
and then pass in MyES directly.



Mattias
 
Back
Top