Пример #1
0
 public static IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex)
 {
     if (IntPtr.Size == 8)
     {
         return(GetWindowLongPtr64(hWnd, (int)nIndex));
     }
     return(GetWindowLong32(hWnd, (int)nIndex));
 }
Пример #2
0
 // https://www.pinvoke.net/default.aspx/user32/SetWindowLong.html
 public static IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex, IntPtr dwNewLong)
 {
     if (IntPtr.Size == 8)
     {
         return(SetWindowLongPtr64(hWnd, (int)nIndex, dwNewLong));
     }
     return(new IntPtr(SetWindowLong32(hWnd, (int)nIndex, dwNewLong.ToInt32())));
 }
Пример #3
0
        internal static IntPtr GetWindowLongPtr(IntPtr hwnd, WindowLongFlags nIndex)
        {
            if (IntPtr.Size > 4)
            {
                return(GetWindowLongPtr(hwnd, (int)nIndex));
            }

            return(new IntPtr(GetWindowLong(hwnd, (int)nIndex)));
        }
Пример #4
0
        internal static IntPtr SetWindowLongPtr(IntPtr hwnd, WindowLongFlags nIndex, IntPtr dwNewLong)
        {
            if (IntPtr.Size > 4)
            {
                return(SetWindowLongPtr(hwnd, (int)nIndex, dwNewLong));
            }

            return(new IntPtr(SetWindowLong(hwnd, (int)nIndex, dwNewLong.ToInt32())));
        }
Пример #5
0
 public static IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex, WindowProc dwNewLong)
 {
     if (IntPtr.Size == 8)
     {
         return(SetWindowLongPtr64(hWnd, nIndex, dwNewLong));
     }
     else
     {
         return(new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong)));
     }
 // 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 static IntPtr SetWindowLong(IntPtr hWnd, WindowLongFlags nIndex, uint dwNewLong)
 {
     if (IntPtr.Size == 8)
     {
         return(SetWindowLongPtr64(hWnd, (int)nIndex, (IntPtr)dwNewLong));
     }
     else
     {
         return(new IntPtr(SetWindowLong32(hWnd, (int)nIndex, (int)dwNewLong)));
     }
 }
Пример #7
0
 // 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 static IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex)
 {
     if (IntPtr.Size == 8)
     {
         return(GetWindowLongPtr64(hWnd, nIndex));
     }
     else
     {
         return(GetWindowLongPtr32(hWnd, nIndex));
     }
 }
Пример #8
0
 public static IntPtr SetWindowLongPtr(HandleRef hWnd, WindowLongFlags nIndex, IntPtr dwNewLong)
 {
     if (IntPtr.Size == 8)
     {
         return(SetWindowLongPtr64(hWnd, nIndex, dwNewLong));
     }
     else
     {
         return(new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32())));
     }
 }
Пример #9
0
    internal static IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex)

    {
        if (IntPtr.Size == 8)
        {
            return(GetWindowLong64(hWnd, (int)nIndex));
        }

        else
        {
            return(GetWindowLong32(hWnd, (int)nIndex));
        }
    }
Пример #10
0
    internal static IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex, IntPtr dwNewLong)

    {
        if (IntPtr.Size == 8)
        {
            return(SetWindowLong64(hWnd, (int)nIndex, dwNewLong));
        }

        else
        {
            return(SetWindowLong32(hWnd, (int)nIndex, dwNewLong));
        }
    }
Пример #11
0
    public static IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex)
    {
        int i = IntPtr.Size * 8;

        if (i == 32)
        {
            return(GetWindowLongPtr32(hWnd, (int)nIndex));
        }
        else if (i == 64)
        {
            return(GetWindowLongPtr64(hWnd, (int)nIndex));
        }
        else
        {
            throw new Exception("Not Support");
        }
    }
Пример #12
0
        // 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 (SetWindowLong in 32-bit mode and SetWindowLongPtr in 64-bit mode)
        public static IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex, IntPtr dwNewLong)
        {
            SetLastError(0);

            var result = IntPtr.Size == 8 ?
                         SetWindowLongPtr64(hWnd, nIndex, dwNewLong) :
                         new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));

            var error = Marshal.GetLastWin32Error();

            if (result == IntPtr.Zero &&
                error != 0)
            {
                throw new System.ComponentModel.Win32Exception(error);
            }

            return(result);
        }
Пример #13
0
 static extern int SetWindowLong32(IntPtr hWnd, WindowLongFlags nIndex, WindowProc dwNewLong);
Пример #14
0
 private static extern IntPtr SetWindowLongPtr64(HandleRef hWnd, WindowLongFlags nIndex, IntPtr dwNewLong);
 // This static method is required because Win32 does not support
 // GetWindowLongPtr directly
 public static IntPtr SetWindowLongPtr(IntPtr hwnd, WindowLongFlags nIndex, IntPtr dwNewLong)
 {
     return(IntPtr.Size > 4
         ? SetWindowLongPtr_x64(hwnd, nIndex, dwNewLong)
         : new IntPtr(SetWindowLong(hwnd, nIndex, dwNewLong.ToInt32())));
 }
 private static extern IntPtr GetWindowLongPtr_x64(IntPtr hwnd, WindowLongFlags nIndex);
Пример #17
0
 public static long GetWindowLong(IntPtr hWnd, WindowLongFlags nIndex)
 {
     return (IntPtr.Size == 4 ? GetWindowLong32(hWnd, nIndex) : GetWindowLong64(hWnd, nIndex)).ToInt64();
 }
Пример #18
0
 static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, WindowLongFlags nIndex, IntPtr dwNewLong);
Пример #19
0
 static extern IntPtr SetWindowLongPtr64(IntPtr hWnd, WindowLongFlags nIndex, IntPtr dwNewLong);
Пример #20
0
 public static IntPtr SetWindowLongPtr(HandleRef hWnd, WindowLongFlags nIndex, IntPtr dwNewLong)
 {
     return IntPtr.Size == 8
         ? SetWindowLongPtr64(hWnd, nIndex, dwNewLong)
         : new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));
 }
 private static extern int SetWindowLong(IntPtr hwnd, WindowLongFlags nIndex, int dwNewLong);
Пример #22
0
 public static IntPtr GetWindowLongPtr(IntPtr hwnd, WindowLongFlags nIndex)
 {
     return(User32Methods.GetWindowLongPtr(hwnd, (int)nIndex));
 }
Пример #23
0
 public static extern IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex);
Пример #24
0
 public static IntPtr SetWindowLongPtr(IntPtr hwnd, WindowLongFlags nIndex, IntPtr dwNewLong)
 {
     return(User32Methods.SetWindowLongPtr(hwnd, (int)nIndex, dwNewLong));
 }
Пример #25
0
 public static IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex)
 {
     if (IntPtr.Size == 8)
         return NativeMethods.GetWindowLong64(hWnd, (int)nIndex);
     else
         return NativeMethods.GetWindowLong32(hWnd, (int)nIndex);
 }
Пример #26
0
 private static extern IntPtr GetWindowLong64(IntPtr hWnd, WindowLongFlags nIndex);
Пример #27
0
 static extern int SetWindowLong32(IntPtr hWnd, WindowLongFlags nIndex, int dwNewLong);
Пример #28
0
 public static extern IntPtr GetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex);
Пример #29
0
 /// <summary>
 /// Changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory.
 /// </summary>
 /// <param name="hWnd">A handle to the window and, indirectly, the class to which the window belongs..</param>
 /// <param name="nIndex">The zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. To set any other value, specify one of the following values: GWL_EXSTYLE, GWL_HINSTANCE, GWL_ID, GWL_STYLE, GWL_USERDATA, GWL_WNDPROC </param>
 /// <param name="dwNewLong">The replacement value.</param>
 /// <returns>If the function succeeds, the return value is the previous value of the specified 32-bit integer.
 /// If the function fails, the return value is zero. To get extended error information, call GetLastError. </returns>
 static IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex, IntPtr dwNewLong)
 {
     if (IntPtr.Size == 8)
     return SetWindowLongPtr64(hWnd, nIndex, dwNewLong);
       else
     return new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));
 }
Пример #30
0
 private void TimerCallback(IntPtr hWnd, WindowLongFlags msg, IntPtr timerId, uint time)
 {
     OnTick();
 }
Пример #31
0
 public static extern int SetWindowLong(IntPtr hWnd, [MarshalAs(UnmanagedType.I4)] WindowLongFlags nIndex, IntPtr dwNewLong);
Пример #32
0
 // 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 static IntPtr SetWindowLongPtr(HandleRef hWnd, WindowLongFlags nIndex, IntPtr dwNewLong) =>
 IntPtr.Size == 8
     ? SetWindowLongPtr64(hWnd, nIndex, dwNewLong)
     : new IntPtr(SetWindowLong32(hWnd, nIndex, dwNewLong.ToInt32()));
Пример #33
0
 public static extern int GetWindowLong(IntPtr hwnd, WindowLongFlags index);
Пример #34
0
 private static extern int SetWindowLong32(HandleRef hWnd, WindowLongFlags nIndex, int dwNewLong);
Пример #35
0
 public IntPtr SetParam(WindowLongFlags index, IntPtr value)
 {
     return(User32Methods.SetWindowLongPtr(this.Handle, (int)index, value));
 }
Пример #36
0
 public static IntPtr SetWindowLongPtr(IntPtr hWnd, WindowLongFlags nIndex, IntPtr dwNewLong)
 {
     if (IntPtr.Size == 8)
         return NativeMethods.SetWindowLong64(hWnd, (int)nIndex, dwNewLong);
     else
         return NativeMethods.SetWindowLong32(hWnd, (int)nIndex, dwNewLong);
 }
Пример #37
0
 private void TimerCallback(IntPtr hWnd, WindowLongFlags msg, IntPtr timerId, uint time)
 {
     OnTick();
 }
Пример #38
0
 public IntPtr GetParam(WindowLongFlags index)
 {
     return(User32Methods.GetWindowLongPtr(this.Handle, (int)index));
 }
Пример #39
0
 private static extern int SetWindowLong32(HandleRef hWnd, WindowLongFlags nIndex, int dwNewLong);
 private static extern IntPtr SetWindowLongPtr_x64(IntPtr hwnd, WindowLongFlags nIndex, IntPtr dwNewLong);
Пример #41
0
 public static extern int SetWindowLong(IntPtr hWnd, WindowLongFlags nIndex, int dwNewLong);
Пример #42
0
 private static extern IntPtr SetWindowLongPtr64(HandleRef hWnd, WindowLongFlags nIndex, IntPtr dwNewLong);