Triggering taskbar button flash from batch file?

五迷三道 提交于 2019-11-30 08:22:35
Andreas Rejbrand

It is very easy to do using a very simple external *.exe. It simply has to call the FlashWindowEx function of the Windows API.

This is a sample Delphi console application:

program flashwnd;

{$APPTYPE CONSOLE}

uses
  SysUtils, Windows;

var
  OldTitle, UniqueTitle: string;
  h: HWND;
  c: cardinal;
  fwi: TFlashWInfo;

begin

  try
    h := GetConsoleWindow();

    c := 10;
    if ParamCount = 1 then
      c := StrToInt(ParamStr(1));

    FillChar(fwi, sizeof(fwi), 0);
    fwi.cbSize := sizeof(fwi);
    fwi.hwnd := h;
    fwi.dwFlags := FLASHW_ALL;
    fwi.uCount := c;
    fwi.dwTimeout := 0;
    FlashWindowEx(fwi);
  except
    on E: Exception do
      Writeln(E.ClassName + ': ' + E.Message);
  end;
end.

Simply call it like

flashwnd

to flash the current console window ten times. Call

flashwnd 27

to flash the window 27 times.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!