我正在开发一个控制机器的应用程序.
当我从机器收到错误时,用户应该能够直接注意到它,一种方法是在任务栏上闪烁托盘.当机器清除错误时,托盘应停止闪烁.
使用FlashWindowEx函数有一点烦恼,当我清除窗口的闪烁时,它(在我的情况下是winXP)保持橙色(不闪烁).
[Flags] public enum FlashMode { /// /// Stop flashing. The system restores the window to its original state. /// FLASHW_STOP = 0, /// /// Flash the window caption. /// FLASHW_CAPTION = 1, /// /// Flash the taskbar button. /// FLASHW_TRAY = 2, /// /// Flash both the window caption and taskbar button. /// This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags. /// FLASHW_ALL = 3, /// /// Flash continuously, until the FLASHW_STOP flag is set. /// FLASHW_TIMER = 4, /// /// Flash continuously until the window comes to the foreground. /// FLASHW_TIMERNOFG = 12 } public static bool FlashWindowEx(IntPtr hWnd, FlashMode fm) { FLASHWINFO fInfo = new FLASHWINFO(); fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); fInfo.hwnd = hWnd; fInfo.dwFlags = (UInt32)fm; fInfo.uCount = UInt32.MaxValue; fInfo.dwTimeout = 0; return FlashWindowEx(ref fInfo); } [StructLayout(LayoutKind.Sequential)] public struct FLASHWINFO { public UInt32 cbSize; public IntPtr hwnd; public UInt32 dwFlags; public UInt32 uCount; public UInt32 dwTimeout; }
在我的情况下,我使用FLASHW_TRAY开始闪烁,使用FLASHW_STOP来停止闪烁.
我做错了什么或者这是WinXP的已知错误并且有解决方法吗?