How can I make a system tray flash - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How can I make a system tray flash

DevelopmentDevelopment Posts: 222Member
hey I am trying to make it so when my program is minimized it will flash on system can anyone help me?
Slewis

Comments

  • ManningManning Posts: 1,621Member
    : hey I am trying to make it so when my program is minimized it will flash on system can anyone help me?

    Flash on the task bar, or in the system tray? If it's in the task bar, there is an API call for that. I don't know it off-hand though.

    If it's in the system tray, then just have a timer change the icon of the system tray component between your programs icon and something else (maybe no icon). If you look, you could probably find a system tray component that has flash capability built in.
  • DevelopmentDevelopment Posts: 222Member
    [b][red]This message was edited by Development at 2004-5-4 22:59:15[/red][/b][hr]
    I dont mean that I have icon on taskbar.

    I just like it to flash when minimized like on yahoo when sum one sends a message to you and the message window is minimized it flashes untill you click on it to show window how can I do this?

    thanks for reading this
    Slewis



  • netgertnetgert Posts: 331Member
    : [b][red]This message was edited by Development at 2004-5-4 22:59:15[/red][/b][hr]
    : I dont mean that I have icon on taskbar.
    :
    : I just like it to flash when minimized like on yahoo when sum one sends a message to you and the message window is minimized it flashes untill you click on it to show window how can I do this?
    :
    : thanks for reading this
    : Slewis
    :
    :
    :
    :
    dont have yahoo, but for the taskbar there was something like FlashWindow(hwnd) which will make the window button on taskbar to go blue (orange on xp blue theme) and back to normal after second call
    [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]

  • mohfamohfa Posts: 13Member
    : : [b][red]This message was edited by Development at 2004-5-4 22:59:15[/red][/b][hr]
    : : I dont mean that I have icon on taskbar.
    : :
    : : I just like it to flash when minimized like on yahoo when sum one sends a message to you and the message window is minimized it flashes untill you click on it to show window how can I do this?
    : :
    : : thanks for reading this
    : : Slewis
    : :
    : :
    : :
    : :
    : dont have yahoo, but for the taskbar there was something like FlashWindow(hwnd) which will make the window button on taskbar to go blue (orange on xp blue theme) and back to normal after second call
    : [hr][red][italic][b]N[/b][/red][blue]et[/blue][red][b]G[/b][/red][blue]ert[/italic][/blue][hr]
    :
    :ok all what you have to do is : that is a simple unite so use it good luck

    // Define FLASHWINFO structure as record type
    type
    FLASHWINFO = record
    cbSize: UINT;
    hWnd: HWND;
    dwFlags: DWORD;
    uCount: UINT;
    dwTimeOut: DWORD;
    end;
    TFlashWInfo = FLASHWINFO;

    // Define dwFlags constants
    const
    FLASHW_STOP = 0;
    FLASHW_CAPTION = 1;
    FLASHW_TRAY = 2;
    FLASHW_ALL = FLASHW_CAPTION or FLASHW_TRAY;
    FLASHW_TIMER = 4;
    FLASHW_TIMERNOFG = 12;

    var
    Form1: TForm1;
    FWInfo: TFlashWInfo;

    // Function declaration for WinAPI call
    function FlashWindowEx(var pfwi: FLASHWINFO): BOOL; stdcall;

    {...}

    implementation

    {...}

    // Import external function from 'USER32.DLL' with the same name
    function FlashWindowEx; external user32 Name 'FlashWindowEx';

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    // Check for API function's availability
    if not Assigned(@FlashWindowEx) then
    begin
    ShowMessage('API Function FlashWindowEx is not present... Exit program!');
    Application.Terminate;
    end
    else
    // Set default parameters
    with FWInfo do
    begin
    cbSize := SizeOf(FWInfo); // Size of structure in bytes
    hWnd := Form1.Handle; // Main's form handle
    dwFlags := FLASHW_ALL; // Flash both caption & task bar
    uCount := 10; // Flash 10 times
    dwTimeOut := 100; // Timeout is 1/10 second apart
    end;
    end;

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    // Flash on normal state
    FlashWindowEx(FWInfo);
    end;

    procedure TForm1.Button2Click(Sender: TObject);
    begin
    // Flash on minimized state
    WindowState := wsMinimized; // Application.Minimize;
    FlashWindowEx(FWInfo);
    end;



Sign In or Register to comment.