【问题标题】:Flashing Window not working for TabbedThumbnail (custom taskbar preview)闪烁窗口不适用于 TabbedThumbnail(自定义任务栏预览)
【发布时间】:2015-08-04 15:17:30
【问题描述】:

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

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

这没问题,但是当我调用闪烁窗口的方法时,任务栏正在闪烁,但由 TabbedThumbnail 表示的窗口不是。

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

图片问题:

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

图片 s4b:

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

感谢您的宝贵时间!

【问题讨论】:

    标签: c# .net wpf user32 taskbar


    【解决方案1】:

    我自己找到了答案。我下载了 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...
        }
    }
    

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

    【讨论】:

      猜你喜欢
      • 2010-09-07
      • 2015-01-29
      • 2011-07-04
      • 1970-01-01
      • 2010-09-06
      • 2011-09-12
      • 2022-11-09
      • 1970-01-01
      相关资源
      最近更新 更多