Flashing window does not work for TabbedThumbnail (taskbar preview)

For my application, I am using FlashWindowEx (ref FLASHWINFO pwfi) from the user32.dll file to launch the taskbar and my attention window.

I am currently trying to add a custom window preview image to the taskbar, the best way I found this using the TaskbarManager in WindowsAPICodePack.

This works well, but when I call the method to start the window, the taskbar blinks, but the window that is presented with TabbedThumbnail is not.

A sample program that uses this is Skype for Business (formerly Lync). To better understand what is going on and what I would like to have, I have added an image and a demo project.

image problem:

image problem

Is there a way to combine both of these features, like skype for business?

S4b image:

image s4b

Source for the demo project: http://project14.net/Dev/csharp/FlashingCustomTaskbarItem.zip

Thank you for your time!

+3


source to share


1 answer


I found the answer myself. I downloaded WindowsAPICodePack and expanded GlassWindow. It took a while to get things right in WPF.

Here's an example for winForms: http://www.codeproject.com/Articles/45567/Creating-a-Timer-Using-the-Amazing-New-Windows-F

You can intercept Windows messages by adding a hook to the HwndSource.



protected override void OnSourceInitialized(EventArgs e)
{
    base.OnSourceInitialized(e);
    HwndSource source = PresentationSource.FromVisual(this) as HwndSource;
    source.AddHook(WndProc);
}

private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, 

ref bool handled)
{
    if(msg == (int)TaskbarNativeMethods.WM_DWMSENDICONICLIVEPREVIEWBITMAP)
    {
        // get your bitmap an SetIconicThumbnail...
    }
}

      

Still trying to improve my code with some better features.

+2


source







All Articles