FlashWindowEx FLASHW_STOP still retains taskbar color

I am developing an application that controls a machine.
When I get an error message from the machine, users should be able to immediately notice it, one way to do this is to blink the tray on the taskbar. When the machine clears the error, the tray should stop flashing.

There is one slight annoyance using the FlashWindowEx function, when I clear the window flicker, it remains (in my case winXP) orange (does not blink).
Sample of status


    [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;
        }

In my case, I use FLASHW_TRAY to start blinking and FLASHW_STOP to stop blinking.

Am I doing something wrong or is this a known WinXP error and is there a fix for it?

+5
4

, , : . , . , FLASHW_STOP, , - . , , , , . .

+4

:

fInfo.uCount = UInt32.MaxValue;

fInfo.uCount FLASHW_STOP. , stop, , .

undefined: http://msdn.microsoft.com/en-us/library/windows/desktop/ms679348(v=vs.85).aspx

, , .

+3

, .

If this is the expected functionality, I think it is not so useful, at least it should be reset.

Now I fixed it only with a combination FLASHW_ALL | FLASHW_TIMERNOFG.

Btw, can't rate your answers until you have a reputation.

0
source

Just set uCount to 0 to stop blinking.

0
source

All Articles