c# – 任务栏通知发光
发布时间:2020-12-16 01:57:27 所属栏目:百科 来源:网络整理
导读:我有一个TCP聊天应用程序.当新消息到来时,我想让任务栏发光,直到用户再次打开表单(如果没有焦点/激活). 我的意思的一个例子: http://puu.sh/4z01n.png 我怎么能让它像那样发光? 谢谢! 如果你仍然不明白我的意思..我提供的图像是当任何“发光”的东西出现
我有一个TCP聊天应用程序.当新消息到来时,我想让任务栏发光,直到用户再次打开表单(如果没有焦点/激活).
我的意思的一个例子: 我怎么能让它像那样发光? 谢谢! 如果你仍然不明白我的意思..我提供的图像是当任何“发光”的东西出现在任务栏上的图标上.意思是有一个通知.这就是我想要实现的目标. 解决方法
我希望这能帮到您
[DllImport("User32.dll")] [return:MarshalAs(UnmanagedType.Bool)] static extern bool FlashWindowEx(ref FLASHINFO pwfi); [StructLayout(LayoutKind.Sequential)] public struct FLASHWINFO { public UInt32 cbSize; public IntPtr hwnd; public UInt32 dwFlags; public UInt32 uCount; public UInt32 dwTimeout; } [Flags] public enum FlashMode { /// /// Stop flashing. The system restores the window to its original state. /// FLASHW_STOP = 0,/// /// Flash the window caption. /// FLASHW_CAPTION = 1,/// /// Flash the taskbar button. /// FLASHW_TRAY = 2,/// /// Flash both the window caption and taskbar button. /// This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags. /// FLASHW_ALL = 3,/// /// Flash continuously,until the FLASHW_STOP flag is set. /// FLASHW_TIMER = 4,/// /// Flash continuously until the window comes to the foreground. /// FLASHW_TIMERNOFG = 12 } public static bool FlashWindow(IntPtr hWnd,FlashMode fm) { FLASHWINFO fInfo = new FLASHWINFO(); fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo)); fInfo.hwnd = hWnd; fInfo.dwFlags = (UInt32)fm; fInfo.uCount = UInt32.MaxValue; fInfo.dwTimeout = 0; return FlashWindowEx(ref fInfo); } 取自我的维基在Flashing Taskbar (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |