static void Main(string[] args) { Console.Title = "123"; IntPtr intptr = User32Extension.FindWindow(null, "123"); intptr = User32Extension.FindWindow("ConsoleWindowClass", null); //if (intptr != IntPtr.Zero) //{ // Console.WriteLine("找到"); // User32Extension.FlashWindow(intptr, true); //} //else //{ // Console.WriteLine("没找到"); //} var vvv = GetAllDesktopWindows().Where(p => p.szWindowName == "微信"); foreach (var item in vvv) { Console.WriteLine(string.Format("hWnd:{0,-10} className:{1,-20} WindowName:{2}", item.hWnd, item.szClassName, item.szWindowName)); User32Extension.FlashWindow(item.hWnd, true); } Console.ReadKey(); }
private void button1_Click(object sender, EventArgs e) { User32Extension.FlashWindow(this.Handle, true); }