Search code examples
c++windowstaskbar

Blink/Alert in Taskbar for c++


I'm writing my own class to create and handle a progress/overlayicons for a programs taskbar icon.

I'm using the ITaskbarList3 for Windows 7/higher to do this. I can now create a progress or overlayicons, but what I'm missing is the alert/blink effect, that appears if a program wants to get the users attention (e.g. if you have to confirm admin rights and are working on a different tab).

I do not mean the pause/error-indicators for a progress, I need the blinking orange effect, and i wasn't able to find something until now.

Thanks for your help.


Solution

  • Use FlashWindowEx function. See the doc on FLASHWINFO - you can start flashing, stop flashing and specify flashing parameters.

    For continuous blinking until the user clicks on the window the code is like this:

    FLASHWINFO fi;
    fi.cbSize = sizeof(FLASHWINFO);
    fi.hwnd = yourHwnd;
    fi.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG;
    fi.uCount = 0;
    fi.dwTimeout = 0;
    FlashWindowEx(&fi);