Hi,
Why you convert it to int32 ?
IMO you should keep it as IntPtr, it's more descriptive and less error
prone.
I feel the same regarding the Free call, you are releasing it so maybe you
lost the referenced memory.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"ano" <an*@discussions.microsoft.com> wrote in message
news:9B**********************************@microsof t.com...
Thanks Marc, how about "VarPtr()"?
I have created this function. Is it work as VarPtr() in VB?
private static int VarPtr(object o)
{
System.Runtime.InteropServices.GCHandle GC;
GC = System.Runtime.InteropServices.GCHandle.Alloc(o,
System.Runtime.InteropServices.GCHandleType.Pinned );
int ret = GC.AddrOfPinnedObject().ToInt32();
GC.Free();
return ret;
}
"Marc Gravell" wrote:
Does .ToString("X2") do what you need?
Marc