闪烁 Window 不适用于 TabbedThumbnail(自定义任务栏预览)

Flashing Window not working for TabbedThumbnail (custom taskbar preview)

对于我的应用程序,我使用 FlashWindowEx(ref FLASHWINFO pwfi) 形成 user32.dll 来闪烁任务栏和我的 window 以引起注意。

此时我正在尝试为任务栏中的 window 预览添加自定义图像,我发现的最佳方法是使用 WindowsAPICodePack 中的 TaskbarManager。

这没问题,但是当我调用方法使 window 闪烁时,任务栏正在闪烁,但由 TabbedThumbnail 表示的 Window 却没有。

使用它的程序示例是 Skype for Business(以前的 Lync)。为了更清楚地说明发生了什么以及我想要什么,我添加了一张图片和一个演示项目。

图像问题:

有没有办法将这两个功能结合在一起,就像 Skype for business 所做的那样?

图片 s4b:

演示项目的来源: http://project14.net/Dev/csharp/FlashingCustomTaskbarItem.zip

谢谢你的时间!

我自己找到了答案。我下载了 WindowsAPICodePack 并扩展了 GlassWindow。在 WPF 中把一切都弄好花了一段时间。

这是 winForms 的示例:http://www.codeproject.com/Articles/45567/Creating-a-Timer-Using-the-Amazing-New-Windows-F

可以通过向 HwndSource 添加一个挂钩来拦截 windows 消息。

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...
    }
}

现在仍在尝试使用一些更好的功能来改进我的代码。