Beispiel #1
0
        private static extern int SetWindowLongPtr64(IntPtr hWnd, GetWindowLongEnum nIndex,
#if WAPICP3
                                                     long
#else
                                                     int
#endif
                                                     dwNewLong);
Beispiel #2
0
        //[DllImport(User32)]
        //public static extern int SetWindowLong(IntPtr hwnd, GetWindowLong index, uint newStyle);

        /// <summary>
        /// <para>Changes an attribute of the specified window. The function also sets a value at the specified offset in the extra window memory.</para>
        /// <para>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 (<see cref="GetWindowLongPtr32(IntPtr, GetWindowLongEnum)"/> in 32-bit mode and <see cref="GetWindowLongPtr64(IntPtr, GetWindowLongEnum)"/> in 64-bit mode).</para>
        /// </summary>
        /// <param name="hWnd"><para>A handle to the window and, indirectly, the class to which the window belongs. The <see cref="SetWindowLongPtr(IntPtr, GetWindowLongEnum, long)"/> function fails if the process that owns the window specified by the hWnd parameter is at a higher process privilege in the UIPI hierarchy than the process the calling thread resides in.</para>
        /// <para>Windows XP/2000: The <see cref="SetWindowLongPtr(IntPtr, GetWindowLongEnum, long)"/> function fails if the window specified by the hWnd parameter does not belong to the same process as the calling thread.</para></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 a LONG_PTR. To set any other value, specify one of the values of the <see cref="GetWindowLongEnum"/>.</param>
        /// <param name="dwNewLong">The replacement value.</param>
        /// <returns><para>If the function succeeds, the return value is the previous value of the specified offset.</para>
        /// <para>If the function fails, the return value is zero. To get extended error information, call <see cref="GetLastWin32Error"/>.</para>
        /// <para>If the previous value is zero and the function succeeds, the return value is zero, but the function does not clear the last error information. To determine success or failure, clear the last error information by calling SetLastError with 0, then call <see cref="SetWindowLongPtr(IntPtr, GetWindowLongEnum, long)"/>.Function failure will be indicated by a return value of zero and a <see cref="GetLastWin32Error"/> result that is nonzero.</para></returns>
        public static int SetWindowLongPtr(IntPtr hWnd, GetWindowLongEnum nIndex,
#if WAPICP3
                                           long
#else
                                           int
#endif
                                           dwNewLong) => IntPtr.Size == 8
                    ? SetWindowLongPtr64(hWnd, nIndex, dwNewLong)
                    : SetWindowLong32(hWnd, nIndex, dwNewLong);
Beispiel #3
0
 GetWindowLongPtr(IntPtr hWnd, GetWindowLongEnum nIndex) => IntPtr.Size == 8 ? GetWindowLongPtr64(hWnd, nIndex) : GetWindowLongPtr32(hWnd, nIndex);
Beispiel #4
0
 private static extern int GetWindowLongPtr64(IntPtr hWnd, GetWindowLongEnum nIndex);
Beispiel #5
0
 private static extern int SetWindowLongPtr64(IntPtr hWnd, GetWindowLongEnum nIndex, uint dwNewLong);
Beispiel #6
0
        //[DllImport(User32)]
        //public static extern int SetWindowLong(IntPtr hwnd, GetWindowLong index, uint newStyle);

        /// <summary>
        /// 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).
        /// </summary>
        /// <param name="hWnd">The pointer to the window.</param>
        /// <param name="nIndex">The property to set.</param>
        /// <param name="dwNewLong">The value to set.</param>
        /// <returns></returns>
        public static int SetWindowLongPtr(IntPtr hWnd, GetWindowLongEnum nIndex, uint dwNewLong) => IntPtr.Size == 8
                    ? SetWindowLongPtr64(hWnd, nIndex, dwNewLong)
                    : SetWindowLong32(hWnd, nIndex, dwNewLong);