当新消息到达时,如何让任务栏像 Messenger 一样使我的应用程序闪烁? [英] How to make the taskbar blink my application like Messenger does when a new message arrive?
本文介绍了当新消息到达时,如何让任务栏像 Messenger 一样使我的应用程序闪烁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 .NET 或本机 DLL 中是否有 API 调用可用于在与我聊天的人做出响应时创建与 Windows Live Messenger 类似的行为?
Is there an API call in .NET or a native DLL that I can use to create similar behaviour as Windows Live Messenger when a response comes from someone I chat with?
推荐答案
FlashWindowEx 是要走的路.请参阅此处了解 MSDN 文档
FlashWindowEx is the way to go. See here for MSDN documentation
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
[StructLayout(LayoutKind.Sequential)]
public struct FLASHWINFO
{
public UInt32 cbSize;
public IntPtr hwnd;
public UInt32 dwFlags;
public UInt32 uCount;
public UInt32 dwTimeout;
}
public const UInt32 FLASHW_ALL = 3;
调用函数:
FLASHWINFO fInfo = new FLASHWINFO();
fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
fInfo.hwnd = hWnd;
fInfo.dwFlags = FLASHW_ALL;
fInfo.uCount = UInt32.MaxValue;
fInfo.dwTimeout = 0;
FlashWindowEx(ref fInfo);
这是从 Pinvoke.net
这篇关于当新消息到达时,如何让任务栏像 Messenger 一样使我的应用程序闪烁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文