// This helper static method is required because the 32-bit version of user32.dll does not contain this API // (on any versions of Windows), so linking the method will fail at run-time. The bridge dispatches the request // to the correct function (GetWindowLong in 32-bit mode and GetWindowLongPtr in 64-bit mode) public IntPtr SetWindowLongPtr(HandleRef hWnd, int nIndex, IntPtr dwNewLong) { if (IntPtr.Size == 8) { return(PInvoker.SetWindowLongPtr64(hWnd, nIndex, dwNewLong)); } else { return(new IntPtr(PInvoker.SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()))); } }