Exemplo n.º 1
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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 9
0
 public static int GetWindowLong(HandleRef hWnd, WindowLongValue nIndex)
 {
     return(GetWindowLong(hWnd, nIndex, out _));
 }
Exemplo n.º 10
0
 public static IntPtr SetWindowLong(HandleRef hWnd, WindowLongValue nIndex, IntPtr dwNewLong)
 {
     return(SetWindowLong(hWnd, nIndex, dwNewLong, out _));
 }