当前位置:  开发笔记 > 编程语言 > 正文

FlashWindowEx FLASHW_STOP仍然保持任务栏的颜色

如何解决《FlashWindowExFLASHW_STOP仍然保持任务栏的颜色》经验,为你挑选了0个好方法。

我正在开发一个控制机器的应用程序.
当我从机器收到错误时,用户应该能够直接注意到它,一种方法是在任务栏上闪烁托盘.当机器清除错误时,托盘应停止闪烁.

使用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的已知错误并且有解决方法吗?

推荐阅读
黄晓敏3023
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有