gpt4 book ai didi

windows - 当新消息到达时,如何使任务栏像 Messenger 一样使我的应用程序闪烁?

转载 作者:可可西里 更新时间:2023-11-01 12:15:46 24 4
gpt4 key购买 nike

是否有 .NET 中的 API 调用或 native DLL 可用于在与我聊天的人响应时创建与 Windows Live Messenger 类似的行为?

最佳答案

FlashWindowEx 是必经之路。参见 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插入的

关于windows - 当新消息到达时,如何使任务栏像 Messenger 一样使我的应用程序闪烁?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73162/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com