convert class instance to IntPtr

  • Thread starter Thread starter swartzbill2000
  • Start date Start date
S

swartzbill2000

I want to PostMessage from a class instance to its containing form. I
want the WPARAM to point to the class instance. I am using the
declaration of PostMessage from www.pinvoke.net. WPARAM is an IntPtr.
VB2005 won't let me do this:
CType(Me, IntPtr)
How can I pass Me as the WPARAM arg?
Bill
 
I want to PostMessage from a class instance to its containing form. I
want the WPARAM to point to the class instance. I am using the
declaration of PostMessage from www.pinvoke.net. WPARAM is an IntPtr.
VB2005 won't let me do this:
CType(Me, IntPtr)
How can I pass Me as the WPARAM arg?
Bill

Might be able to use System.Runtime.InteropServices.Marshal methods to get
the interface you need.

Maybe Marshal.GetIDispatchForObject?

HTH,
Mythran
 
I found GCHandle. It works.
Bill said:
Might be able to use System.Runtime.InteropServices.Marshal methods to get
the interface you need.

Maybe Marshal.GetIDispatchForObject?

HTH,
Mythran
 
Back
Top