public static void Flash(this IWin32Window window, int count, FlashWindowFlags flashWindowFlags)
 {
     if (window == null)
         throw new NullReferenceException();
     var info = new FlashWindowInfo(window.Handle, flashWindowFlags, (uint)count);
     info.Flash();
 }
示例#2
0
 public void FlashWindow(FlashWindowFlags fOptions, uint FlashCount, uint FlashRate)
 {
     if (_hwndSource != null)
     {
         FlashWindow(_hwndSource.Handle, fOptions, FlashCount, FlashRate);
     }
 }
示例#3
0
 public FlashWindowInfo(IntPtr handle, FlashWindowFlags flags, uint count, uint timeout)
 {
     _size         = Convert.ToUInt32(Marshal.SizeOf(typeof(FlashWindowInfo)));
     _windowHandle = handle;
     _flags        = flags;
     _count        = count;
     _timeout      = timeout;
 }
 public FlashWindowInfo(IntPtr handle, FlashWindowFlags flags, uint flashCount, uint flashRate)
 {
     Size = Convert.ToUInt32(Marshal.SizeOf(typeof(FlashWindowInfo)));
     WindowHandle = handle;
     Flags = flags;
     FlashCount = flashCount;
     FlashRate = flashRate;
 }
示例#5
0
 public FlashWindowInfo(IntPtr Handle, FlashWindowFlags Flags, uint Count, uint Timeout)
 {
     hWnd      = Handle;
     cbSize    = (uint)Marshal.SizeOf(typeof(FlashWindowInfo));
     dwFlags   = Flags;
     uCount    = Count;
     dwTimeout = Timeout;
 }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="form"></param>
        /// <param name="count"></param>
        /// <param name="flags"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        public static bool FlashWindow(WinForms.Form form, uint count,
                                       FlashWindowFlags flags, uint timeout)
        {
            FlashWindowInfo info = new FlashWindowInfo();

            info.cbSize    = 20;
            info.dwFlags   = 0x0000000C | (uint)flags;           // FLASHW_TIMERNOFG
            info.dwTimeout = timeout;
            info.hwnd      = form.Handle;
            info.uCount    = count;

            return(FlashWindowEx(ref info));
        }
示例#7
0
        /// <summary>
        /// Flashes the window.
        /// </summary>
        private static bool FlashWindow(IntPtr hWnd, FlashWindowFlags options = (FlashWindowFlags.FLASHW_ALL | FlashWindowFlags.FLASHW_TIMERNOFG), uint count = 3, uint rate = 0)
        {
            if (hWnd == IntPtr.Zero)
            {
                return(false);
            }
            FLASHWINFO fi = new FLASHWINFO();

            fi.cbSize    = (uint)Marshal.SizeOf(typeof(FLASHWINFO));
            fi.dwFlags   = options;
            fi.uCount    = count;
            fi.dwTimeout = rate;
            fi.hwnd      = hWnd;
            return(FlashWindowEx(ref fi));
        }
示例#8
0
        public static void FlashWindowEx(IntPtr windowHandle, FlashWindowFlags flags, int count, TimeSpan timeout)
        {
            HandleManipulator.ValidateAsArgument(windowHandle, "windowHandle");

            var flashInfo = new FlashInfo
            {
                Size    = Marshal.SizeOf(typeof(FlashInfo)),
                Hwnd    = windowHandle,
                Flags   = flags,
                Count   = count,
                Timeout = Convert.ToInt32(timeout.TotalMilliseconds)
            };

            User32.FlashWindowEx(ref flashInfo);
        }
示例#9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="form"></param>
        /// <param name="count"></param>
        /// <param name="flags"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        public static bool FlashWindowUntilStop(WinForms.Form form, uint count,
                                                FlashWindowFlags flags, uint timeout)
        {
            if (flags == 0)
            {
                throw new ArgumentException("Flags cannot be zero", "flags");
            }

            FlashWindowInfo info = new FlashWindowInfo();

            info.cbSize    = 20;
            info.dwFlags   = 0x00000004 | (uint)flags;           // FLASHW_TIMER
            info.dwTimeout = timeout;
            info.hwnd      = form.Handle;
            info.uCount    = count;

            return(FlashWindowEx(ref info));
        }
示例#10
0
        public static bool FlashWindow(IntPtr hWnd,
                                       FlashWindowFlags fOptions,
                                       uint FlashCount,
                                       uint FlashRate)
        {
            if (IntPtr.Zero != hWnd)
            {
                FLASHWINFO fi = new FLASHWINFO();
                fi.cbSize = (uint)Marshal.SizeOf(typeof(FLASHWINFO));
                fi.dwFlags = fOptions;
                fi.uCount = FlashCount;
                fi.dwTimeout = FlashRate;
                fi.hwnd = hWnd;

                return FlashWindowEx(ref fi);
            }
            return false;
        }
示例#11
0
        public static bool FlashWindow(IntPtr hWnd,
                                       FlashWindowFlags fOptions,
                                       uint FlashCount,
                                       uint FlashRate)
        {
            if (IntPtr.Zero != hWnd)
            {
                FLASHWINFO fi = new FLASHWINFO();
                fi.cbSize    = (uint)Marshal.SizeOf(typeof(FLASHWINFO));
                fi.dwFlags   = fOptions;
                fi.uCount    = FlashCount;
                fi.dwTimeout = FlashRate;
                fi.hwnd      = hWnd;

                return(FlashWindowEx(ref fi));
            }
            return(false);
        }
示例#12
0
        /// <summary>
        ///     Flashes the specified window. It does not change the active state of the window.
        /// </summary>
        /// <param name="windowHandle">A handle to the window to be flashed. The window can be either opened or minimized.</param>
        /// <param name="flags">The flash status.</param>
        /// <param name="count">The number of times to flash the window.</param>
        /// <param name="timeout">The rate at which the window is to be flashed.</param>
        public static void FlashWindowEx(IntPtr windowHandle, FlashWindowFlags flags, int count, TimeSpan timeout)
        {
            // Check if the handle is valid
            HandleManipulator.ValidateAsArgument(windowHandle, "windowHandle");

            // Create the data structure
            var flashInfo = new FlashInfo
            {
                Size    = Marshal.SizeOf(typeof(FlashInfo)),
                Hwnd    = windowHandle,
                Flags   = flags,
                Count   = count,
                Timeout = Convert.ToInt32(timeout.TotalMilliseconds)
            };

            // Flash the window
            User32.FlashWindowEx(ref flashInfo);
        }
示例#13
0
 public FlashWindowInfo(IntPtr handle, FlashWindowFlags flags, uint flashCount)
     : this(handle, flags, flashCount, 0)
 { }
示例#14
0
 /// <summary>
 ///     Flashes the specified window. It does not change the active state of the window. The function uses the default
 ///     cursor blink rate.
 /// </summary>
 /// <param name="windowHandle">A handle to the window to be flashed. The window can be either opened or minimized.</param>
 /// <param name="flags">The flash status.</param>
 public static void FlashWindowEx(IntPtr windowHandle, FlashWindowFlags flags)
 {
     FlashWindowEx(windowHandle, flags, 0);
 }
示例#15
0
 /// <summary>
 ///     Flashes the specified window. It does not change the active state of the window. The function uses the default
 ///     cursor blink rate.
 /// </summary>
 /// <param name="windowHandle">A handle to the window to be flashed. The window can be either opened or minimized.</param>
 /// <param name="flags">The flash status.</param>
 /// <param name="count">The number of times to flash the window.</param>
 public static void FlashWindowEx(IntPtr windowHandle, FlashWindowFlags flags, int count)
 {
     FlashWindowEx(windowHandle, flags, count, TimeSpan.FromMilliseconds(0));
 }
示例#16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="form"></param>
 /// <param name="count"></param>
 /// <param name="flags"></param>
 /// <returns></returns>
 public static bool FlashWindowUntilStop(WinForms.Form form, uint count, FlashWindowFlags flags)
 {
     return(FlashWindowUntilStop(form, count, flags, 0));
 }
示例#17
0
 public void FlashWindow(FlashWindowFlags fOptions, uint FlashCount, uint FlashRate)
 {
     if (_hwndSource != null)
         FlashWindow(_hwndSource.Handle, fOptions, FlashCount, FlashRate);
 }
示例#18
0
 /// <summary>
 ///     Flashes the specified window. It does not change the active state of the window. The function uses the default
 ///     cursor blink rate.
 /// </summary>
 /// <param name="windowHandle">A handle to the window to be flashed. The window can be either opened or minimized.</param>
 /// <param name="flags">The flash status.</param>
 public static void FlashWindowEx(IntPtr windowHandle, FlashWindowFlags flags)
 {
     FlashWindowEx(windowHandle, flags, 0);
 }
示例#19
0
        /// <summary>
        ///     Flashes the specified window. It does not change the active state of the window.
        /// </summary>
        /// <param name="windowHandle">A handle to the window to be flashed. The window can be either opened or minimized.</param>
        /// <param name="flags">The flash status.</param>
        /// <param name="count">The number of times to flash the window.</param>
        /// <param name="timeout">The rate at which the window is to be flashed.</param>
        public static void FlashWindowEx(IntPtr windowHandle, FlashWindowFlags flags, uint count, TimeSpan timeout)
        {
            // Check if the handle is valid
            HandleManipulator.ValidateAsArgument(windowHandle, "windowHandle");

            // Create the data structure
            var flashInfo = new FlashInfo {Size = Marshal.SizeOf(typeof (FlashInfo)), Hwnd = windowHandle, Flags = flags, Count = count, Timeout = Convert.ToInt32(timeout.TotalMilliseconds)};

            // Flash the window
            NativeMethods.FlashWindowEx(ref flashInfo);
        }
示例#20
0
 public FlashWindowInfo(IntPtr handle, FlashWindowFlags flags, uint count)
     : this(handle, flags, count, 0)
 {
 }
示例#21
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="form"></param>
        /// <param name="count"></param>
        /// <param name="flags"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        public static bool FlashWindow(WinForms.Form form, uint count,
            FlashWindowFlags flags, uint timeout)
        {
            FlashWindowInfo info = new FlashWindowInfo();

            info.cbSize = 20;
            info.dwFlags = 0x0000000C | (uint)flags; // FLASHW_TIMERNOFG
            info.dwTimeout = timeout;
            info.hwnd = form.Handle;
            info.uCount = count;

            return FlashWindowEx(ref info);
        }
示例#22
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="form"></param>
 /// <param name="count"></param>
 /// <param name="flags"></param>
 /// <returns></returns>
 public static bool FlashWindowUntilStop(WinForms.Form form, uint count, FlashWindowFlags flags)
 {
     return FlashWindowUntilStop(form, count, flags, 0);
 }
示例#23
0
 /// <summary>
 ///     Flashes the specified window. It does not change the active state of the window. The function uses the default
 ///     cursor blink rate.
 /// </summary>
 /// <param name="windowHandle">A handle to the window to be flashed. The window can be either opened or minimized.</param>
 /// <param name="flags">The flash status.</param>
 /// <param name="count">The number of times to flash the window.</param>
 public static void FlashWindowEx(IntPtr windowHandle, FlashWindowFlags flags, uint count)
 {
     FlashWindowEx(windowHandle, flags, count, TimeSpan.FromMilliseconds(0));
 }
示例#24
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="form"></param>
        /// <param name="count"></param>
        /// <param name="flags"></param>
        /// <param name="timeout"></param>
        /// <returns></returns>
        public static bool FlashWindowUntilStop(WinForms.Form form, uint count,
            FlashWindowFlags flags, uint timeout)
        {
            if (flags == 0)
                throw new ArgumentException("Flags cannot be zero", "flags");

            FlashWindowInfo info = new FlashWindowInfo();

            info.cbSize = 20;
            info.dwFlags = 0x00000004 | (uint)flags; // FLASHW_TIMER
            info.dwTimeout = timeout;
            info.hwnd = form.Handle;
            info.uCount = count;

            return FlashWindowEx(ref info);
        }
示例#25
0
 /// <summary>
 /// Flashes the window. It does not change the active state of the window.
 /// </summary>
 /// <param name="count">The number of times to flash the window.</param>
 /// <param name="timeout">The rate at which the window is to be flashed.</param>
 /// <param name="flags">The flash status.</param>
 public void Flash(uint count, TimeSpan timeout, FlashWindowFlags flags = FlashWindowFlags.All)
 {
     WindowCore.FlashWindowEx(Handle, flags, count, timeout);
 }
示例#26
0
 /// <summary>
 ///     Flashes the window. It does not change the active state of the window.
 /// </summary>
 /// <param name="count">The number of times to flash the window.</param>
 /// <param name="timeout">The rate at which the window is to be flashed.</param>
 /// <param name="flags">The flash status.</param>
 public void Flash(int count, TimeSpan timeout, FlashWindowFlags flags = FlashWindowFlags.All)
 {
     AWindowHelper.FlashWindowEx(Handle, flags, count, timeout);
 }