3
votes

For my application I'm using the FlashWindowEx(ref FLASHWINFO pwfi) form the user32.dll to flash the taskbar and my window for attention.

At this moment I am trying to add a custom image for the preview of the window in the taskbar, best way I found is by using the TaskbarManager in the WindowsAPICodePack.

This works alright, but when I call the method to flash the window, the taskbar is flashing but the Window wich is represented by a TabbedThumbnail is not.

Sample of a program that is using this is Skype for Business (former Lync). To make more clear what is happening and what I would like to have, I added a image and a demo project.

image problem:

image problem

Is there a way to get both of these features together, like skype for business is doing?

image s4b:

image s4b

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

Thanks for you time!

1

1 Answers

2
votes

I found an answer myself. I downloaded the WindowsAPICodePack and extended the GlassWindow. It took a while to get everything right in WPF.

Here is a sample for winForms: http://www.codeproject.com/Articles/45567/Creating-a-Timer-Using-the-Amazing-New-Windows-F

Interceptiinbg the windows messages can be done 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 now.