convert class instance to IntPtr

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • swartzbill2000@yahoo.com

    #1

    convert class instance to IntPtr

    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

  • Mythran

    #2
    Re: convert class instance to IntPtr


    <swartzbill2000 @yahoo.comwrote in message
    news:1154964568 .151460.99710@i 3g2000cwc.googl egroups.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.GetIDis patchForObject?

    HTH,
    Mythran


    Comment

    • swartzbill2000@yahoo.com

      #3
      Re: convert class instance to IntPtr

      I found GCHandle. It works.
      Bill
      Mythran wrote:
      <swartzbill2000 @yahoo.comwrote in message
      news:1154964568 .151460.99710@i 3g2000cwc.googl egroups.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.GetIDis patchForObject?
      >
      HTH,
      Mythran

      Comment

      Working...