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;
		}
 public static bool flashTaskBar(IntPtr hWnd, falshType type)
 {
     FLASHWINFO fInfo = new FLASHWINFO();
     fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
     fInfo.hwnd = hWnd;
     fInfo.dwFlags = (uint)type;
     fInfo.uCount = Convert.ToUInt32(5);
     fInfo.dwTimeout = 1000; //窗口闪烁的频度,毫秒为单位;若该值为0,则为默认图标的闪烁频度
     return FlashWindowEx(ref fInfo);
 }
Example #3
0
 public static void Flash(Form mainForm)
 {
     FLASHWINFO fw = new FLASHWINFO();
     fw.cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(FLASHWINFO)));
     fw.hwnd = mainForm.Handle;
     // Flash both the window caption and the taskbar button until the window comes to the foreground
     fw.dwFlags = (Int32)(FLASHWINFOFLAGS.FLASHW_ALL | FLASHWINFOFLAGS.FLASHW_TIMERNOFG);
     fw.dwTimeout = 0;
     FlashWindowEx(ref fw);
 }
Example #4
0
 /// <summary>
 /// 指定されたウィンドウを点滅する
 /// </summary>
 /// <param name="iHandle">ウィンドウハンドル</param>
 /// <param name="iFlashMode">点滅モード</param>
 /// <param name="iFlashCount">点滅回数</param>
 public static void FlashWindow(IntPtr iHandle, UInt32 iFlashMode = FLASHW_ALL, uint iFlashCount = 5)
 {
     FLASHWINFO fInfo = new FLASHWINFO();
     fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
     fInfo.hwnd = iHandle;
     fInfo.dwFlags = iFlashMode;
     fInfo.uCount = iFlashCount; // 点滅する回数
     fInfo.dwTimeout = 0;
     FlashWindowEx(ref fInfo);
 }
Example #5
0
        public static int FlashWindowStop(System.Windows.Forms.Form hWnd)
        {
            FLASHWINFO fw = new FLASHWINFO();
            fw.cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(FLASHWINFO)));
            fw.hwnd = hWnd.Handle;
            fw.dwFlags = (Int32)( FLASHWINFOFLAGS.FLASHW_STOP);
            fw.dwTimeout = 0;

            return FlashWindowEx(ref fw);
        }
Example #6
0
        public bool FlashWindow()
        {
            FLASHWINFO fw = new FLASHWINFO();

            fw.cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(FLASHWINFO)));
            fw.hwnd = this.Handle;
            fw.dwFlags = 0xf;
            fw.uCount = UInt32.MaxValue;

            return FlashWindowEx(ref fw);
        }
Example #7
0
 private static void InternalFlash(Form form, FlashFlags flags)
 {
     FLASHWINFO fw = new FLASHWINFO
     {
         cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(FLASHWINFO))),
         hwnd = form.Handle,
         dwFlags = (int)flags,
         uCount = uint.MaxValue
     };
     FlashWindowEx(ref fw);
 }
Example #8
0
 public static void Stop(Window win)
 {
     WindowInteropHelper h = new WindowInteropHelper(win);
     FLASHWINFO info = new FLASHWINFO();
     info.hwnd = h.Handle;
     info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info));
     info.dwFlags = FLASHW_STOP;
     info.uCount = UInt32.MaxValue;
     info.dwTimeout = 0;
     FlashWindowEx(ref info);
 }
 public static void StopFlashing(this Window win)
 {
     WindowInteropHelper h = new WindowInteropHelper(win);
     FLASHWINFO info = new FLASHWINFO();
     info.hwnd = h.Handle;
     info.dwFlags = FLASHW_STOP;
     info.uCount = uint.MaxValue;
     info.dwTimeout = 0;
     info.cbSize = (sizeof(uint) * 4) + (uint)IntPtr.Size;
     FlashWindowEx(ref info);
 }
Example #10
0
 public void Flash()
 {
     var info = new FLASHWINFO
         {
             cbSize = (uint) Marshal.SizeOf(typeof (FLASHWINFO)),
             hwnd = new WindowInteropHelper(Application.Current.MainWindow).Handle,
             dwFlags = (int) (FLASHWINFOFLAGS.FLASHW_ALL | FLASHWINFOFLAGS.FLASHW_TIMERNOFG),
             dwTimeout = 0
         };
     FlashWindowEx(ref info);
 }
Example #11
0
        public static void StopFlashingWindow(Form win)
        {
            FLASHWINFO info = new FLASHWINFO();
            info.hwnd = win.Handle;
            info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info));
            info.dwFlags = FLASHW_STOP;
            info.uCount = UInt32.MaxValue;
            info.dwTimeout = 0;

            FlashWindowEx(ref info);
        }
Example #12
0
        /// Minor adjust to the code above
        /// <summary>
        /// Flashes a window until the window comes to the foreground
        /// Receives the form that will flash
        /// </summary>
        /// <param name="hWnd">The handle to the window to flash</param>
        /// <returns>whether or not the window needed flashing</returns>
        public static bool FlashWindowEx(IntPtr hWnd)
        {
            FLASHWINFO fInfo = new FLASHWINFO();

            fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd = hWnd;
            fInfo.dwFlags = FlashWindowFlags.FLASHW_ALL | FlashWindowFlags.FLASHW_TIMERNOFG;
            fInfo.uCount = UInt32.MaxValue;
            fInfo.dwTimeout = 0;

            return FlashWindowEx(ref fInfo);
        }
Example #13
0
        internal static void FlashWindow(Process process)
        {
            FLASHWINFO pwfi = new FLASHWINFO();

            pwfi.cbSize = Convert.ToUInt32(Marshal.SizeOf(pwfi));
            pwfi.hwnd = process.MainWindowHandle;
            pwfi.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
            pwfi.uCount = uint.MaxValue;
            pwfi.dwTimeout = 0;

            FlashWindowEx(ref pwfi);
        }
Example #14
0
        /// <summary>
        /// Flashes the window the specified number of times.
        /// </summary>
        /// <remarks>
        /// http://stackoverflow.com/questions/73162/how-to-make-the-taskbar-blink-my-application-like-messenger-does-when-a-new-messa
        /// </remarks>
        /// <param name="numberOfTimes">Number of times to flash the window.</param>
        /// <returns>The return value specifies the window's state before the call to the FlashWindowEx function. 
        /// If the window caption was drawn as active before the call, the return value is true. Otherwise, 
        /// the return value is zero.</returns>
        private bool FlashWindow(int numberOfTimes)
        {
            FLASHWINFO fInfo = new FLASHWINFO();

            fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd = Bot.ConsoleWindow;
            fInfo.dwFlags = FLASHW_ALL;
            fInfo.uCount = Convert.ToUInt32(numberOfTimes);
            fInfo.dwTimeout = 0;

            return FlashWindowEx(ref fInfo);
        }
Example #15
0
        private static void FlashConsoleWindow(IntPtr hWnd)
        {
            FLASHWINFO fInfo = new FLASHWINFO();

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

            FlashWindowEx(ref fInfo);
        }
        /// <summary>
        /// Flashes a window
        /// </summary>
        /// <param name="hWnd">The handle to the window to flash</param>
        /// <returns>whether or not the window needed flashing</returns>
        public static bool FlashWindowEx(IntPtr hWnd, UInt32 flag)
        {
            FLASHWINFO fInfo = new FLASHWINFO();

            fInfo.cbSize = (ushort)Marshal.SizeOf(fInfo);
            fInfo.hwnd = hWnd;
            fInfo.dwFlags = flag;
            fInfo.uCount = UInt16.MaxValue;
            fInfo.dwTimeout = 0;

            return (FlashWindowEx(ref fInfo) == 0);
        }
Example #17
0
        public static bool FlashWindowEx(IntPtr hWnd)
        {
            FLASHWINFO fInfo = new FLASHWINFO();

            fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd = hWnd;
            fInfo.dwFlags = FLASHW_ALL;
            fInfo.uCount = 3;
            fInfo.dwTimeout = 0;

            return (FlashWindowEx(ref fInfo) == 0);
        }
Example #18
0
        /// <summary>
        /// Flashes a form continuously until the form comes to the foreground.
        /// </summary>
        /// <param name="form">The form to flash.</param>
        public static void FlashForm(Form form)
        {
            FLASHWINFO flashInfo = new FLASHWINFO()
            {
                cbSize = (uint)Marshal.SizeOf(typeof(FLASHWINFO)),
                dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG,
                dwTimeout= 500,
                hwnd = form.Handle,
            };

            FlashWindowEx(ref flashInfo);
        }
        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 = FLASHW_STOP;
            info.uCount = uint.MaxValue;
            info.dwTimeout = 0;

            FlashWindowEx(ref info);
        }
Example #20
0
        public static bool Flash(this MetroWindow form)
        {
            IntPtr hWnd = new WindowInteropHelper(form).Handle;
            FLASHWINFO fInfo = new FLASHWINFO();

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

            return FlashWindowEx(ref fInfo);
        }
Example #21
0
    /// <summary>
    /// Stops flashing the form's taskbar button.
    /// </summary>
    /// <param name="form"></param>
    public static void Unflash(Form form)
    {
        FLASHWINFO fw = new FLASHWINFO()
        {
            cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(FLASHWINFO))),
            hwnd = form.Handle,
            dwFlags = (Int32)(FLASHWINFOFLAGS.FLASHW_STOP),
            uCount = 0,
            dwTimeout = 0
        };

        FlashWindowEx(ref fw);
    }
Example #22
0
 public static void StopFlashingWindow(this Window window)
 {
     WindowInteropHelper helper = new WindowInteropHelper(window);
     var info = new FLASHWINFO()
     {
         hwnd = helper.Handle,
         dwFlags = FLASHW_STOP,
         uCount = UInt32.MaxValue,
         dwTimeout = 0
     };
     info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info));
     FlashWindowEx(ref info);
 }
        public static bool FlashWindowEx(newMessageFrm form)
        {
            IntPtr hWnd = form.Handle;
            FLASHWINFO fInfo = new FLASHWINFO();

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

            return FlashWindowEx(ref fInfo);
        }
        /// <summary>
        /// Wrapper for Win32 function "FlashWindowEx"
        /// </summary>
        /// <param name="hWnd">Handle of the window to flash</param>
        public static bool FlashWindow(IntPtr hWnd)
        {
            FLASHWINFO fInfo = new FLASHWINFO();

            fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd = hWnd;                              // Handle to window
            fInfo.uCount = UInt32.MaxValue;                 // Number of times to flash
            fInfo.dwTimeout = 0;                            // Use default cursor blink rate
            // Flash both window caption and taskbar button, until the window is brought to the foreground.
            fInfo.dwFlags = (uint)(FLASHW.ALL | FLASHW.TIMERNOFG);

            return FlashWindowEx(ref fInfo);
        }
Example #25
0
        public static bool FlashConsoleWindow()
        {
            IntPtr hwnd = GetConsoleWindow();
            if (hwnd == IntPtr.Zero)
                return false;

            FLASHWINFO fw = new FLASHWINFO();
            fw.cbSize = Marshal.SizeOf(fw);
            fw.hwnd = hwnd;
            fw.dwFlags = FLASHFLAGS.FLASHW_CAPTION | FLASHFLAGS.FLASHW_TRAY | FLASHFLAGS.FLASHW_TIMERNOFG;
            fw.uCount = -1;
            fw.dwTimeout = 0;
            return FlashWindowEx(ref fw);
        }
Example #26
0
        public static void Flash(this Form window,
            FlashType type = FlashType.FLASHW_TIMERNOFG | FlashType.FLASHW_ALL, UInt32 count = UInt32.MaxValue)
        {
            window.Invoke(new MethodInvoker(delegate
            {
                FLASHWINFO fw = new FLASHWINFO();

                fw.cbSize = Convert.ToUInt32(Marshal.SizeOf(typeof(FLASHWINFO)));
                fw.hwnd = window.Handle;
                fw.dwFlags = (Int32)type;
                fw.uCount = count;

                FlashWindowEx(ref fw);
            }));
        }
 /// <summary>
 /// Flashes the window in the task bar.
 /// </summary>
 /// <param name="window">The Window instance.</param>
 /// <returns></returns>
 public static bool Flash(this Window window)
 {
     IntPtr hWnd = new WindowInteropHelper(window).Handle;
     if (hWnd.ToInt64() != 0)
     {
         FLASHWINFO fInfo = new FLASHWINFO();
         fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
         fInfo.hwnd = hWnd;
         fInfo.dwFlags = FLASHW_TIMER | FLASHW_TRAY;
         fInfo.uCount = 3;
         fInfo.dwTimeout = 0;
         return FlashWindowEx(ref fInfo);
     }
     return false;
 }
Example #28
0
 internal static void FlashWindow(Window window, int times = -1)
 {
     if ( Environment.OSVersion.Platform == PlatformID.Win32NT )
     {
         FLASHWINFO fInfo = new FLASHWINFO();
         var ptr = new System.Windows.Interop.WindowInteropHelper( window );
         fInfo.cbSize = Convert.ToUInt32( Marshal.SizeOf( fInfo ) );
         fInfo.hwnd = ptr.Handle;
         //fInfo.dwFlags = FLASHW_TIMERNOFG;
         fInfo.dwFlags = FLASHW_TRAY | 8;
         fInfo.uCount = (uint)( times <= 0 ? 3 : times );
         fInfo.dwTimeout = 0;
         FlashWindowEx( ref fInfo );
     }
 }
Example #29
0
        private const UInt32 FLASHW_TRAY = 2; //Flash the taskbar button.

        #endregion Fields

        #region Methods

        public static void Flash(Window win, UInt32 count = UInt32.MaxValue)
        {
            //Don't flash if the window is active
            if (win.IsActive) return;
            WindowInteropHelper h = new WindowInteropHelper(win);
            FLASHWINFO info = new FLASHWINFO
            {
                hwnd = h.Handle,
                dwFlags = FLASHW_ALL | FLASHW_TIMER,
                uCount = count,
                dwTimeout = 0
            };

            info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info));
            FlashWindowEx(ref info);
        }
Example #30
0
        public static void FlashWindow(IntPtr handle)
        {
            IntPtr      hWnd    = handle;
            FLASHWINFO  fInfo   = new FLASHWINFO();

            fInfo.cbSize    = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd      = hWnd;
            fInfo.dwFlags   = Win32Interop.FLASHW_ALL |
                              Win32Interop.FLASHW_TIMERNOFG |
                              Win32Interop.FLASHW_CAPTION;

            fInfo.uCount    = UInt32.MaxValue;
            fInfo.dwTimeout = 0;

            FlashWindowEx(ref fInfo);
        }
Example #31
0
        public static void FlashWindow(this Window win, UInt32 count = UInt32.MaxValue)
        {
            //Don't flash if the window is active
            if (win.IsActive)
            {
                return;
            }

            WindowInteropHelper h = new WindowInteropHelper(win);

            FLASHWINFO info = new FLASHWINFO
            {
                hwnd      = h.Handle,
                dwFlags   = FLASHW_ALL | FLASHW_TIMER,
                uCount    = count,
                dwTimeout = 0
            };

            info.cbSize = Convert.ToUInt32(Marshal.SizeOf(info));
            FlashWindowEx(ref info);
        }
Example #32
0
 public static Int32 FlashWindow(Form frm, bool flashTitleBar, bool flashTray, int flashAmount)
 {
     try {
         FLASHWINFO fwi    = new FLASHWINFO();
         var        _with1 = fwi;
         _with1.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(fwi);
         _with1.hwnd   = frm == null ? IntPtr.Zero : frm.Handle;
         if (flashTitleBar)
         {
             _with1.dwFlags = _with1.dwFlags | FLASHW_CAPTION;
         }
         if (flashTray)
         {
             _with1.dwFlags = _with1.dwFlags | FLASHW_TRAY;
         }
         _with1.uCount    = flashAmount;
         _with1.dwTimeout = 250;
         return(FlashWindowEx(ref fwi));
     } catch {
         return(-1);
     }
 }
Example #33
0
        public static void FlashWindow(Window window, FlashMode mode)
        {
            FLASHWINFO fInfo = new FLASHWINFO();

            fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd   = new System.Windows.Interop.WindowInteropHelper(window).Handle;

            switch (mode)
            {
            case FlashMode.Stop:
                fInfo.dwFlags = FLASHW_STOP;
                break;

            case FlashMode.Caption:
                fInfo.dwFlags = FLASHW_CAPTION;
                break;

            case FlashMode.Tray:
                fInfo.dwFlags = FLASHW_TRAY;
                break;

            case FlashMode.All:
                fInfo.dwFlags = FLASHW_ALL;
                break;

            case FlashMode.UntilStop:
                fInfo.dwFlags = FLASHW_TIMER;
                break;

            case FlashMode.UntilForeground:
                fInfo.dwFlags = FLASHW_TIMERNOFG;
                break;
            }

            fInfo.uCount    = UInt32.MaxValue;
            fInfo.dwTimeout = 0;

            FlashWindowEx(ref fInfo);
        }
Example #34
0
        /// <summary>
        /// Start Flashing the specified Window (form)
        /// </summary>
        /// <param name="form">The Form (Window) to Flash.</param>
        /// <returns></returns>
        public static bool Start(System.Windows.Forms.Form form)
        {
            disableFlashing.Change(60000, Timeout.Infinite);
            lock ( flashingForms )
            {
                if (!flashingForms.Contains(form))
                {
                    flashingForms.Add(form);
                }
            }
            if (form.InvokeRequired)
            {
                return((bool)form.Invoke(new InvokeFormUpdateDelegate(f =>
                {
                    FLASHWINFO fi2 = Create_FLASHWINFO(form.Handle, FLASHW_ALL, uint.MaxValue, 0);
                    return FlashWindowEx(ref fi2);
                }), form));
            }
            FLASHWINFO fi = Create_FLASHWINFO(form.Handle, FLASHW_ALL, uint.MaxValue, 0);

            return(FlashWindowEx(ref fi));
        }
Example #35
0
        /// <summary>
        /// Stop Flashing the specified Window (form)
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public static bool Stop(System.Windows.Forms.Form form)
        {
            lock ( flashingForms )
            {
                if (flashingForms.Contains(form))
                {
                    flashingForms.Remove(form);
                }
            }
            if (form.InvokeRequired)
            {
                return((bool)form.Invoke(new InvokeFormUpdateDelegate(f =>
                {
                    FLASHWINFO fi2 = Create_FLASHWINFO(form.Handle, FLASHW_STOP, uint.MaxValue, 0);
                    return FlashWindowEx(ref fi2);
                }), form));
            }

            FLASHWINFO fi = Create_FLASHWINFO(form.Handle, FLASHW_STOP, uint.MaxValue, 0);

            return(FlashWindowEx(ref fi));
        }
Example #36
0
        /// <summary>
        /// Send form taskbar notification, the Window will flash until get's focus
        /// <remarks>
        /// This method allows to Flash a Window, signifying to the user that some major event occurred within the application that requires their attention.
        /// </remarks>
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public static bool FlashNotification(this Form form, bool stop)
        {
            IntPtr     hWnd  = form.Handle;
            FLASHWINFO fInfo = new FLASHWINFO();

            fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
            fInfo.hwnd   = hWnd;

            if (!stop)
            {
                fInfo.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
                fInfo.uCount  = uint.MaxValue;
            }
            else
            {
                fInfo.dwFlags = FLASHW_STOP;
                fInfo.uCount  = 0;
            }

            fInfo.dwTimeout = 0;

            return(FlashWindowEx(ref fInfo));
        }
Example #37
0
        public static bool FlashWindow(IntPtr handle, bool flashTitleBar, bool flashTray, int flashCount)
        {
            if (handle == null)
            {
                return(false);
            }

            try
            {
                FLASHWINFO fwi = new FLASHWINFO();
                fwi.hwnd = handle;
                if (flashTitleBar)
                {
                    fwi.dwFlags = fwi.dwFlags | FlashWindowFlags.FLASHW_CAPTION;
                }

                if (flashTray)
                {
                    fwi.dwFlags = fwi.dwFlags | FlashWindowFlags.FLASHW_TRAY;
                }

                fwi.uCount = (uint)flashCount;

                if (flashCount == 0)
                {
                    fwi.dwFlags = fwi.dwFlags | FlashWindowFlags.FLASHW_TIMERNOFG;
                }

                fwi.dwTimeout = 0;
                fwi.cbSize    = (uint)System.Runtime.InteropServices.Marshal.SizeOf(fwi);
                return(FlashWindowEx(ref fwi));
            }
            catch
            {
                return(false);
            }
        }
Example #38
0
 private void timer2_Tick(object sender, EventArgs e)
 {
     if (mode == TimerMode.Timer)
     {
         if (time == new TimeSpan(00, 00, 00))
         {
             timer2.Enabled = false;
             FLASHWINFO fInfo = new FLASHWINFO();
             fInfo.cbSize    = Convert.ToUInt32(Marshal.SizeOf(fInfo));
             fInfo.hwnd      = GetMainWindowHandle("devenv");
             fInfo.dwFlags   = FLASHW_TIMERNOFG;
             fInfo.dwTimeout = 10;
             FlashWindowEx(ref fInfo);
             MessageBox.Show("時間です。", "通知", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         time        = time.Subtract(new TimeSpan(00, 00, 01));
         label1.Text = time.ToString();
     }
     if (mode == TimerMode.StopWatch)
     {
         time        = time.Add(new TimeSpan(00, 00, 01));
         label1.Text = time.ToString();
     }
 }
Example #39
0
        public static bool FlashWindow(IWin32Window window, int flashCount)
        {
            bool result = false;

            if (window != null)
            {
                const uint FLASHW_CAPTION = 1;
                const uint FLASHW_TRAY    = 2;
                const uint FLASHW_ALL     = FLASHW_CAPTION | FLASHW_TRAY;

                FLASHWINFO info = new FLASHWINFO
                {
                    cbSize    = FLASHWINFO.SizeOf,
                    hwnd      = window.Handle,
                    dwFlags   = FLASHW_ALL,
                    uCount    = flashCount,
                    dwTimeout = 0,
                };

                result = FlashWindowEx(ref info);
            }

            return(result);
        }
        public static bool Flash(this Window form, uint count = 5)
        {
            if (Win2000OrLater)
            {
                // The calling thread cannot access this object because a different thread owns it.
                var Handle = default(IntPtr);

                form.Dispatcher.Invoke(
                    new Action(
                        delegate
                {
                    WindowInteropHelper helper = new WindowInteropHelper(form);

                    Handle = helper.Handle;
                }
                        )
                    );


                FLASHWINFO fi = Create_FLASHWINFO(Handle, FLASHW_TRAY, count, 0);
                return(FlashWindowEx(ref fi));
            }
            return(false);
        }
        /// <summary>
        /// Flash the spacified Window (Form) until it recieves focus.
        /// </summary>
        /// <param name="form">The Form (Window) to Flash.</param>
        /// <returns></returns>
        public static Boolean Flash(Form form)
        {
            FLASHWINFO fi = Create_FLASHWINFO(form.Handle, FLASHW_ALL | FLASHW_TIMERNOFG, uint.MaxValue, 0);

            return(FlashWindowEx(ref fi));
        }
        /// <summary>
        /// Stop Flashing the specified Window (form)
        /// </summary>
        /// <param name="form"></param>
        /// <returns></returns>
        public static Boolean Stop(Form form)
        {
            FLASHWINFO fi = Create_FLASHWINFO(form.Handle, FLASHW_STOP, uint.MaxValue, 0);

            return(FlashWindowEx(ref fi));
        }
        public static bool Flash(Form form, uint count)
        {
            FLASHWINFO FW = Create_FLASHWINFO(form.Handle, 3, count, 0);

            return((Win2000OrLater && (form != null)) && FlashWindowEx(ref FW));
        }
 public extern static int FlashWindow(
     IntPtr hWnd,
     ref FLASHWINFO pwfi);
 static extern Int16 FlashWindowEx(ref FLASHWINFO pwfi);
Example #46
0
 private static extern bool FlashWindowEx(
     ref FLASHWINFO FWInfo);
Example #47
0
 private static extern short FlashWindowEx(ref FLASHWINFO pwfi);
Example #48
0
 static extern void FlashWindowEx(ref FLASHWINFO pwfi);
 internal static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
Example #50
0
 private static extern int FlashWindowEx(FLASHWINFO flashInfo);
Example #51
0
 public static extern bool FlashWindowEx([MarshalAs(UnmanagedType.Struct)]
                                         ref FLASHWINFO pfwi);
Example #52
0
 [DllImport("user32.dll")][return : MarshalAs(UnmanagedType.Bool)] static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
Example #53
0
 public static extern Int32 FlashWindowEx(ref FLASHWINFO pwfi);
Example #54
0
 public static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
Example #55
0
 private static extern Int32 FlashWindowEx(ref FLASHWINFO pwfi);
Example #56
0
 public static extern int FlashWindowEx(ref FLASHWINFO pfwi);
        public static bool Stop(Form form)
        {
            FLASHWINFO FW = Create_FLASHWINFO(form.Handle, 0, uint.MaxValue, 0);

            return((Win2000OrLater && (form != null)) && FlashWindowEx(ref FW));
        }
Example #58
0
 public static void FlashWindow(ref FLASHWINFO f)
 {
     //直接调用FlashWindow即可
     FlashWindowEx(ref f);
 }
Example #59
0
 private static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
        /// <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 Boolean Flash(Form form, int count)
        {
            FLASHWINFO fi = Create_FLASHWINFO(form.Handle, FLASHW_ALL, (uint)count, 0);

            return(FlashWindowEx(ref fi));
        }