How to make a WPF Window to blink on the taskbar?

后端 未结 4 2202
醉话见心
醉话见心 2020-12-23 14:25

A given moment my WPF app needs user attention. I know it is possible to make the Windows 7 taskbar icon to flash with a yellow color.

I tried so far:

4条回答
  •  误落风尘
    2020-12-23 15:05

    Scott's example is much simpler... thank you Scott!

    https://scottstoecker.wordpress.com/2010/10/08/creating-a-flashing-taskbar-icon-using-flashwindow-with-xaml/

    using System.Windows.Interop;
    using System.Runtime.InteropServices;
    
    [DllImport("user32")] public static extern int FlashWindow(IntPtr hwnd, bool bInvert);
    
    WindowInteropHelper wih = new WindowInteropHelper(ThisWindow); 
    FlashWindow(wih.Handle, true);
    

提交回复
热议问题