|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
convert class instance to IntPtrI 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 <swartzbill2***@yahoo.com> wrote in message
news:1154964568.151460.99710@i3g2000cwc.googlegroups.com... Might be able to use System.Runtime.InteropServices.Marshal methods to get >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 > the interface you need. Maybe Marshal.GetIDispatchForObject? HTH, Mythran I found GCHandle. It works.
Bill Mythran wrote: Show quoteHide quote > <swartzbill2***@yahoo.com> wrote in message > news:1154964568.151460.99710@i3g2000cwc.googlegroups.com... > >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 |
|||||||||||||||||||||||