C#的任务栏闪动FlashWindowEx

在C#代码里引入Dll函数

[DllImport("user32.dll")]
        static extern bool FlashWindowEx(ref FLASHWINFO pwfi);

        [DllImport("user32.dll")]
        static extern bool FlashWindow(IntPtr handle, bool invert); 
        
         public const UInt32 FLASHW_STOP = 0;
         public const UInt32 FLASHW_CAPTION = 1;
         public const UInt32 FLASHW_TRAY = 2;
         public const UInt32 FLASHW_ALL = 3;
         public const UInt32 FLASHW_TIMER = 4;
         public const UInt32 FLASHW_TIMERNOFG = 12;

任务栏进行亮闪

this.WindowState = FormWindowState.Minimized; 
 
             FLASHWINFO fInfo = new FLASHWINFO();
 
             fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
             fInfo.hwnd = this.Handle;
             fInfo.dwFlags = FLASHW_TRAY | FLASHW_TIMERNOFG;
             fInfo.uCount = UInt32.MaxValue;
             fInfo.dwTimeout = 0;  
             FlashWindowEx(ref fInfo);

任务栏一直亮着

this.WindowState = FormWindowState.Minimized; 
            FlashWindow(this.Handle,true);

 

作为笔记,以后需要进行复制粘贴

posted @ 2016-02-18 14:33  晓晓晓  阅读(593)  评论(0编辑  收藏  举报