예제 #1
0
        /// <summary>
        /// Flashes the console window
        /// </summary>
        /// <param name="once">if off, flashes repeated until the user makes the console foreground</param>
        public void Flash(bool once)
        {
            IntPtr hwnd = LoggerUtils.GetConsoleWindow();

            if (hwnd == IntPtr.Zero)
            {
                return;
            }

            int style = LoggerUtils.GetWindowLong(hwnd, LoggerUtils.GWL_STYLE);

            if ((style & LoggerUtils.WS_CAPTION) == 0)
            {
                return;
            }

            FlashWInfo info = new FlashWInfo();

            info.Size  = Marshal.SizeOf(typeof(FlashWInfo));
            info.Flags = LoggerUtils.FLASHW_ALL;
            if (!once)
            {
                info.Flags |= LoggerUtils.FLASHW_TIMERNOFG;
            }
            LoggerUtils.FlashWindowEx(ref info);
        }