/// <inheritdoc/> public IntPtr GetWindowLongPtr(IntPtr hwnd, GwlType nIndex) { IntPtr returnValue; if (IntPtr.Size == 8) { // 64 bit system returnValue = GetWindowLongPtr64(hwnd, nIndex); } else { // 32 bit system returnValue = GetWindowLongPtr32(hwnd, nIndex); } if (returnValue == IntPtr.Zero) { HResult.ThrowLastError(); } return(returnValue); }
/// <inheritdoc/> public IntPtr SetWindowLongPtr(IntPtr hwnd, GwlType nIndex, IntPtr dwNewLong) { IntPtr returnValue; if (IntPtr.Size == 8) { // 64 bit system returnValue = SetWindowLongPtr64(hwnd, nIndex, dwNewLong); } else { // 32 bit system returnValue = (IntPtr)SetWindowLongPtr32(hwnd, nIndex, dwNewLong.ToInt32()); } if (returnValue == IntPtr.Zero) { HResult.ThrowLastError(); } return(returnValue); }
private static extern IntPtr GetWindowLongPtr64(IntPtr hwnd, GwlType nIndex);
private static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, GwlType nIndex, IntPtr dwNewLong);
private static extern int SetWindowLongPtr32(IntPtr hWnd, GwlType nIndex, int dwNewLong);