/// <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); }
private static FlashWInfo Create_FLASHWINFO(IntPtr handle, uint flags, uint count, uint timeout) { var 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 void RequestUserAttention() { if (Application.Current.MainWindow == null) { return; } var interop = new WindowInteropHelper(Application.Current.MainWindow); var info = new FlashWInfo { hwnd = interop.Handle, dwFlags = FlashFlags.Tray | FlashFlags.TimerNoForeground, uCount = uint.MaxValue, dwTimeout = 0, cbSize = (uint)Marshal.SizeOf <FlashWInfo>() }; FlashWindowEx(ref info); }
/// <summary> /// Flashes the console window /// </summary> /// <param name="once">if off, flashes repeated until the user makes the console foreground</param> public static void Flash(bool once) { IntPtr hwnd = GetConsoleWindow(); if (hwnd == IntPtr.Zero) { return; } // int style = GetWindowLong(hwnd, GWL_STYLE); // if ((style & WS_CAPTION)==0) // return; FlashWInfo info = new FlashWInfo(); info.Size = Marshal.SizeOf(typeof(FlashWInfo)); info.Flags = FLASHW_ALL; if (!once) { info.Flags |= FLASHW_TIMERNOFG; } FlashWindowEx(ref info); }
private static extern bool FlashWindowEx(ref FlashWInfo pwfi);
public static extern int FlashWindowEx(ref FlashWInfo fwi);
static extern void FlashWindowEx(ref FlashWInfo info);
/// <summary> /// Flashes the console window /// </summary> /// <param name="once">if off, flashes repeated until the user makes the console foreground</param> public static void Flash(bool once) { IntPtr hwnd = GetConsoleWindow(); if (hwnd == IntPtr.Zero) return; int style = GetWindowLong(hwnd, GWL_STYLE); if ((style & WS_CAPTION) == 0) return; FlashWInfo info = new FlashWInfo(); info.Size = Marshal.SizeOf(typeof(FlashWInfo)); info.Flags = FLASHW_ALL; if (!once) info.Flags |= FLASHW_TIMERNOFG; FlashWindowEx(ref info); }
private static FlashWInfo Create_FLASHWINFO(IntPtr handle, uint flags, uint count, uint timeout) { var fi = new FlashWInfo(); fi.cbSize = Convert.ToUInt32(Marshal.SizeOf(fi)); fi.hwnd = handle; fi.dwFlags = flags; fi.uCount = count; fi.dwTimeout = timeout; return fi; }