public static IntPtr SetWindowLong(HandleRef hWnd, WindowLongValue nIndex, IntPtr dwNewLong)
        {
            int    error  = 0;
            IntPtr result = IntPtr.Zero;

            SetLastError(0);
            if (IntPtr.Size == 4)
            {
                int intResult = IntSetWindowLong(hWnd, (int)nIndex, IntPtrToInt32(dwNewLong));
                error  = Marshal.GetLastWin32Error();
                result = new IntPtr(intResult);
            }
            else
            {
                result = IntSetWindowLongPtr(hWnd, (int)nIndex, dwNewLong);
                error  = Marshal.GetLastWin32Error();
            }
            return(result);
        }
示例#2
0
        public static int GetWindowLong(HandleRef hWnd, WindowLongValue nIndex, out int error)
        {
            int result;

            Kernel32.SetLastError(0);
            if (IntPtr.Size == 4)
            {
                result = IntGetWindowLong(hWnd, (int)nIndex);
                error  = Marshal.GetLastWin32Error();
            }
            else
            {
                var resultPtr = IntGetWindowLongPtr(hWnd, (int)nIndex);
                error  = Marshal.GetLastWin32Error();
                result = (int)resultPtr.ToInt64();
            }

            return(result);
        }
        public static int GetWindowLong(HandleRef hWnd, WindowLongValue nIndex)
        {
            int result = 0;
            int error  = 0;

            SetLastError(0);
            if (IntPtr.Size == 4)
            {
                result = IntGetWindowLong(hWnd, (int)nIndex);
                error  = Marshal.GetLastWin32Error();
            }
            else
            {
                IntPtr resultPtr = IntGetWindowLongPtr(hWnd, (int)nIndex);
                error  = Marshal.GetLastWin32Error();
                result = IntPtrToInt32(resultPtr);
            }
            return(result);
        }
示例#4
0
        public static IntPtr SetWindowLong(HandleRef hWnd, WindowLongValue nIndex, IntPtr dwNewLong, out int error)
        {
            IntPtr result;

            Kernel32.SetLastError(0);
            if (IntPtr.Size == 4)
            {
                var intResult = IntSetWindowLong(hWnd, (int)nIndex, (int)dwNewLong.ToInt64());
                error  = Marshal.GetLastWin32Error();
                result = new IntPtr(intResult);
            }
            else
            {
                result = IntSetWindowLongPtr(hWnd, (int)nIndex, dwNewLong);
                error  = Marshal.GetLastWin32Error();
            }

            return(result);
        }
示例#5
0
 public static IntPtr SetWindowLong(HandleRef hWnd, WindowLongValue nIndex, IntPtr dwNewLong)
 {
     int error = 0;
     IntPtr result = IntPtr.Zero;
     SetLastError(0);
     if (IntPtr.Size == 4)
     {
         int intResult = IntSetWindowLong(hWnd, (int)nIndex, IntPtrToInt32(dwNewLong));
         error = Marshal.GetLastWin32Error();
         result = new IntPtr(intResult);
     }
     else
     {
         result = IntSetWindowLongPtr(hWnd, (int)nIndex, dwNewLong);
         error = Marshal.GetLastWin32Error();
     }
     return result;
 }
示例#6
0
 public static int GetWindowLong(HandleRef hWnd, WindowLongValue nIndex)
 {
     int result = 0;
     int error = 0;
     SetLastError(0);
     if (IntPtr.Size == 4)
     {
         result = IntGetWindowLong(hWnd, (int)nIndex);
         error = Marshal.GetLastWin32Error();
     }
     else
     {
         IntPtr resultPtr = IntGetWindowLongPtr(hWnd, (int)nIndex);
         error = Marshal.GetLastWin32Error();
         result = IntPtrToInt32(resultPtr);
     }
     return result;
 }
示例#7
0
 public static IntPtr SetWindowLong(HandleRef hWnd, WindowLongValue nIndex, IntPtr dwNewLong)
 {
     int error;
     IntPtr result;
     SetLastError(0);
     if (IntPtr.Size == 4)
     {
         var intResult = IntSetWindowLong(hWnd, (int) nIndex, IntPtrToInt32(dwNewLong));
         error = Marshal.GetLastWin32Error();
         result = new IntPtr(intResult);
     }
     else
     {
         result = IntSetWindowLongPtr(hWnd, (int) nIndex, dwNewLong);
         error = Marshal.GetLastWin32Error();
     }
     if (error != 0)
     {
         throw new Win32Exception(error);
     }
     return result;
 }
示例#8
0
 public static int GetWindowLong(HandleRef hWnd, WindowLongValue nIndex)
 {
     int result;
     int error;
     SetLastError(0);
     if (IntPtr.Size == 4)
     {
         result = IntGetWindowLong(hWnd, (int) nIndex);
         error = Marshal.GetLastWin32Error();
     }
     else
     {
         var resultPtr = IntGetWindowLongPtr(hWnd, (int) nIndex);
         error = Marshal.GetLastWin32Error();
         result = IntPtrToInt32(resultPtr);
     }
     if (error != 0)
     {
         throw new Win32Exception(error);
     }
     return result;
 }
示例#9
0
 public static int GetWindowLong(HandleRef hWnd, WindowLongValue nIndex)
 {
     return(GetWindowLong(hWnd, nIndex, out _));
 }
示例#10
0
 public static IntPtr SetWindowLong(HandleRef hWnd, WindowLongValue nIndex, IntPtr dwNewLong)
 {
     return(SetWindowLong(hWnd, nIndex, dwNewLong, out _));
 }