Valerie,
Are you doing this to call a method in the UI thread of your app, and
pass that as a parameter? If so, then you should really use the Invoke
method on the Control class, as it is much easier, and was written to do
just this.
If you have a different need, then use the GCHandle structure. You can
call the static Alloc method on the GCHandle structure, and then cast the
GCHandle structure to an IntPtr. You can then cast back to the GCAlloc
instance, and get the object referenced by the GCAlloc structure when you
pass your IntPtr around.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Valerie Hough" <sa***@pcTrans.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
In C#:
How do I construct an IntPtr object to point to an instance of a class,
pass it somewhere, then reference it once again as the original object.?
My specific implementation is to use PostMessage to pass my class instance
as the "lParam" of the message.
Thanks in advance.
Valerie Hough