I found this also very annoying, so I searched for a solution myself. And came up with a small console application that I wrote, with the following code:
using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Windows.Forms; internal class Program { // For Windows Mobile, replace user32.dll with coredll.dll [DllImport("user32.dll", SetLastError = true)] static extern IntPtr FindWindow(string lpClassName, string lpWindowName); // Find window by Caption only. Note you must pass IntPtr.Zero as the first parameter. [DllImport("user32.dll", EntryPoint = "FindWindow", SetLastError = true)] static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName); [DllImport("user32.dll")] // static extern bool ShowWindow(IntPtr hWnd, ShowWindowCommands nCmdShow); static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); internal static void Main(string[] args) { do { Console.Title = "Waiting..."; Console.WriteLine("Waiting..."); IntPtr hwnd = FindWindowByCaption(IntPtr.Zero, "File Modification Detected"); while ((int)hwnd == 0) { Thread.Sleep(500); hwnd = FindWindowByCaption(IntPtr.Zero, "File Modification Detected"); } Console.Title = "Found one, kill it..."; Console.WriteLine("Found one, kill it..."); // ShowNormal = 1 // Show = 5 ShowWindow(hwnd, 5); SendKeys.SendWait("{ENTER}"); Thread.Sleep(500); hwnd = IntPtr.Zero; } while (true); } }
If you run this program, it waits for these pop-ups and will automatically reboot.
Dennis
source share