using System;using System.Runtime.InteropServices;using System.Threading;using System.Windows.Forms;namespace ConsoleApplication1{ /// /// Summary description for Class1. /// class Class1 { [DllImport("user32.dll")] public static extern IntPtr FindWindow(string lpClassName,string lpWindowName); [DllImport("user32.dll")] static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { string strAppName = "\""+AppDomain.CurrentDomain.BaseDirectory+AppDomain.CurrentDomain.FriendlyName+"\""; IntPtr hWnd = FindWindow(null,strAppName); if (hWnd != IntPtr.Zero) { ShowWindow(hWnd,0); if (MessageBox.Show("There are updates. Proceed?","Update Confirm",MessageBoxButtons.YesNo,MessageBoxIcon.Question)==DialogResult.No) { return; } else { ShowWindow(hWnd,0); Thread.Sleep(5000); MessageBox.Show("Updates are complete","System Update",MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Exit(); } } } }}