/// <summary>
 /// Start Flashing the specified Window (form)
 /// </summary>
 /// <param name="form">The Form (Window) to Flash.</param>
 /// <returns></returns>
 public static bool Start(Form form)
 {
     if (Win2000OrLater)
     {
         Flashwinfo fi = Create_FLASHWINFO(form.Handle, FLASHW_ALL, uint.MaxValue, 0);
         return(FlashWindowEx(ref fi));
     }
     return(false);
 }
 /// <summary>
 /// Flash the specified Window (form) for the specified number of times
 /// </summary>
 /// <param name="form">The Form (Window) to Flash.</param>
 /// <param name="count">The number of times to Flash.</param>
 /// <returns></returns>
 public static bool Flash(Form form, uint count)
 {
     if (Win2000OrLater)
     {
         Flashwinfo fi = Create_FLASHWINFO(form.Handle, FLASHW_ALL, count, 0);
         return(FlashWindowEx(ref fi));
     }
     return(false);
 }
        /// <summary>
        /// Stop Flashing the specified process MainWindow
        /// </summary>
        /// <param name="process"></param>
        /// <returns></returns>
        public static bool StopWindowFlashing(Process process)
        {
            if (!Win2000OrLater)
            {
                return(false);
            }
            Flashwinfo fi = Create_FLASHWINFO(process.MainWindowHandle, FLASHW_STOP, uint.MaxValue, 0);

            return(FlashWindowEx(ref fi));
        }
 /// <summary>
 /// Flash the spacified Window (Form) until it recieves focus.
 /// </summary>
 /// <param name="form">The Form (Window) to Flash.</param>
 /// <returns></returns>
 public static bool Flash(Form form)
 {
     // Make sure we're running under Windows 2000 or later
     if (Win2000OrLater)
     {
         Flashwinfo fi = Create_FLASHWINFO(form.Handle, FLASHW_ALL | FLASHW_TIMERNOFG, uint.MaxValue, 0);
         return(FlashWindowEx(ref fi));
     }
     return(false);
 }
        private static Flashwinfo Create_FLASHWINFO(IntPtr handle, uint flags, uint count, uint timeout)
        {
            Flashwinfo fi = new Flashwinfo();

            fi.cbSize    = Convert.ToUInt32(Marshal.SizeOf(fi));
            fi.hwnd      = handle;
            fi.dwFlags   = flags;
            fi.uCount    = count;
            fi.dwTimeout = timeout;
            return(fi);
        }
Exemplo n.º 6
0
        /// <summary>
        ///     The stop flashing window.
        /// </summary>
        /// <param name="win">
        ///     The win.
        /// </param>
        public static void StopFlashingWindow(this Window win)
        {
            var h = new WindowInteropHelper(win);

            var info = new Flashwinfo {hwnd = h.Handle};
            info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info));
            info.dwFlags = FlashwStop;
            info.uCount = uint.MaxValue;
            info.dwTimeout = 0;

            FlashWindowEx(ref info);
        }
Exemplo n.º 7
0
        private static void FlashWindow(IntPtr hWnd)
        {
            Flashwinfo fInfo = new Flashwinfo();

            fInfo.cbSize    = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd      = hWnd;
            fInfo.dwFlags   = FlashwAll;
            fInfo.uCount    = UInt32.MaxValue;
            fInfo.dwTimeout = 0;

            FlashWindowEx(ref fInfo);
        }
Exemplo n.º 8
0
        private static void FlashWindow(IntPtr hWnd)
        {
            Flashwinfo fInfo = new Flashwinfo();

            fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd = hWnd;
            fInfo.dwFlags = FlashwAll;
            fInfo.uCount = UInt32.MaxValue;
            fInfo.dwTimeout = 0;

            FlashWindowEx(ref fInfo);
        }
Exemplo n.º 9
0
        public static void StopFlashingWindow(Window win)
        {
            var h    = new WindowInteropHelper(win);
            var info = new Flashwinfo {
                hwnd = h.Handle
            };

            info.cbSize    = Convert.ToUInt32(Marshal.SizeOf(info));
            info.dwFlags   = FlashwStop;
            info.uCount    = UInt32.MaxValue;
            info.dwTimeout = 0;
            FlashWindowEx(ref info);
        }
Exemplo n.º 10
0
        private const uint FlashwTray = 2; // Flash the taskbar button.

        #endregion Fields

        #region Methods

        /// <summary>
        ///     The flash window.
        /// </summary>
        /// <param name="win">
        ///     The win.
        /// </param>
        /// <param name="count">
        ///     The count.
        /// </param>
        public static void FlashWindow(this Window win, uint count = 5)
        {
            // Don't flash if the window is active
            if (win.IsActive)
                return;

            var h = new WindowInteropHelper(win);

            var info = new Flashwinfo
                {
                    hwnd = h.Handle,
                    dwFlags = FlashwAll | FlashwTimernofg,
                    uCount = count,
                    dwTimeout = 0
                };

            info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info));
            FlashWindowEx(ref info);
        }
Exemplo n.º 11
0
        public static void Flash(Window win, UInt32 count = UInt32.MaxValue)
        {
            //Don't flash if the window is active
            if (win.WindowState == WindowState.Maximized)
            {
                return;
            }
            var h = new WindowInteropHelper(win);

            var info = new Flashwinfo
            {
                hwnd      = h.Handle,
                dwFlags   = FlashwAll | FlashwTimernofg,
                uCount    = count,
                dwTimeout = 0
            };

            info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info));
            FlashWindowEx(ref info);
        }
Exemplo n.º 12
0
        /// <summary>
        ///     The flash window.
        /// </summary>
        /// <param name="win">
        ///     The win.
        /// </param>
        /// <param name="count">
        ///     The count.
        /// </param>
        public static void FlashWindow(this Window win, uint count = 5)
        {
            // Don't flash if the window is active
            if (win.IsActive)
            {
                return;
            }

            var h = new WindowInteropHelper(win);

            var info = new Flashwinfo
            {
                hwnd      = h.Handle,
                dwFlags   = FlashwAll | FlashwTimernofg,
                uCount    = count,
                dwTimeout = 0
            };

            info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info));
            FlashWindowEx(ref info);
        }
Exemplo n.º 13
0
 private static extern bool FlashWindowEx(ref Flashwinfo pwfi);
Exemplo n.º 14
0
 private static extern bool FlashWindowEx(ref Flashwinfo pwfi);