对于我的应用程序,我使用FlashWindowEx(ref FLASHWINFO pwfi)形成user32.dll来刷新任务栏和我的窗口以引起注意。
此时我正在尝试为任务栏中的窗口预览添加自定义图像,我发现的最佳方法是使用WindowsAPICodePack中的TaskbarManager。
这可以正常工作,但是当我调用方法来闪烁窗口时,任务栏正在闪烁,但是TabbedThumbnail表示的窗口不是。
使用此程序的示例是Skype for Business(以前的Lync)。为了更清楚地了解正在发生的事情以及我希望拥有的内容,我添加了一个图像和一个演示项目。
图片问题:
有没有办法将这两个功能集中在一起,就像skype for business正在做什么?
image s4b:
演示项目的来源: http://project14.net/Dev/csharp/FlashingCustomTaskbarItem.zip
谢谢你的时间!
答案 0 :(得分:2)
我自己找到了答案。我下载了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...
}
}
现在仍尝试使用更好的功能来改进我的代码。