I have a window application. When I minimize the window application on taskbar to work on another application. We hava a facility to send messages from one window application to another window application.
So my first win application is minimized and now I open my other win application and then send a message to the first application, but the first application is on the taskbar. So I want functionality like when any message capture my first application then it will blink like skype or any messenger.
I have tried FlashWindowEx
method of User32.dll
, but no luck. I have tried it with the option "Flash continuously until the window comes to the foreground." but no luck.
Please help me solve this problem with an example.
When a taskbar icon flashes orange, it is flashing orange because the application is telling WIndows it wants/requires the user's attention. There is no way to get the flashing application to restore the window/open on the screen automatically.
The icons on the Taskbar are usually static unless there's an activity that requires users' attention, like notification. In that case, the icon changes its color. They become static again after you've opened the app. But sometimes, the icon keeps flickering or flashing even after opening the app.
I do it as shown below, being sure to add the required references as shown
using System.Runtime.InteropServices; using Microsoft.Win32; // To support flashing. [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool FlashWindowEx(ref FLASHWINFO pwfi); //Flash both the window caption and taskbar button. //This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags. public const UInt32 FLASHW_ALL = 3; // Flash continuously until the window comes to the foreground. public const UInt32 FLASHW_TIMERNOFG = 12; [StructLayout(LayoutKind.Sequential)] public struct FLASHWINFO { public UInt32 cbSize; public IntPtr hwnd; public UInt32 dwFlags; public UInt32 uCount; public UInt32 dwTimeout; } // Do the flashing - this does not involve a raincoat. public static bool FlashWindowEx(Form form) { IntPtr hWnd = form.Handle; FLASHWINFO fInfo = new FLASHWINFO(); fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); fInfo.hwnd = hWnd; fInfo.dwFlags = FLASHW_ALL | FLASHW_TIMERNOFG; fInfo.uCount = UInt32.MaxValue; fInfo.dwTimeout = 0; return FlashWindowEx(ref fInfo); }
This should contain everything you need.
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With