convert class instance to IntPtr

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
 
M

Mythran

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
 
S

swartzbill2000

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top