IntPtrに値を代入するコードを紹介します。
IntPtrに値を代入する場合は、値をIntPtrでキャストします。 なお、0を代入する場合には、IntPtr.Zero が利用できます。
IntPtr.Zero
IntPtr result = new IntPtr(); result = (IntPtr)385;
IntPtr result = new IntPtr(); result = IntPtr.Zero;