本文介绍了有没有一种方法,使在任务栏控制台窗口闪存编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 基本上,我提出,执行一些任务需要几分钟控制台应用程序。我想有它在任务栏上闪烁,让我知道什么时候它的完成做它的事。Basically I made console app that performs some task that takes a few minutes. I'd like to have it flash in the taskbar to let me know when it's done doing its thing.推荐答案使用回答@扎克发布和另一个找到一个控制台应用程序我想出了这个和它的伟大工程。Using the answer that @Zack posted and another one to find the handle of a console app I came up with this and it works great.class Program{ [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 Int32 dwTimeout; } public const UInt32 FLASHW_ALL = 3; static void Main(string[] args) { Console.WriteLine("Flashing NOW"); FlashWindow(Process.GetCurrentProcess().MainWindowHandle); Console.WriteLine("Press any key to continue"); Console.ReadKey(); } private static void FlashWindow(IntPtr hWnd) { 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); }} 这篇关于有没有一种方法,使在任务栏控制台窗口闪存编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-13 15:05