static void Main(string [] args) { bool Created; Mutex mutex = new Mutex(false, "ClamWinStartupMutex", out Created); if (!Created) { // ClamWin instance already exist, let pop it up IntPtr Handle = Win32API.FindWindow("WindowsForms10.Window.8.app.0.378734a", "ClamWin Free Antivirus"); if (0 != (int)Handle) { Win32API.SetWindowPos(Handle, Win32API.HWND_TOP, 0, 0, 0, 0, Win32API.SWP_NOSIZE | Win32API.SWP_NOMOVE | Win32API.SWP_SHOWWINDOW ); Win32API.SetForegroundWindow(Handle); OnArguments(args, Handle); mutex.Close(); return; } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new ClamWinMainForm(args)); Application.Run(new ATGmain()); /*try * { * Application.Run(new ClamWinMainForm(args)); * } * catch (SystemException exc) * { * MessageBox.Show( "Exception occured!\r\nWith message - \"" + exc.Message + "\"\r\n Source - \"" + exc.Source + "\"", * "ClamWin", * MessageBoxButtons.OK, * MessageBoxIcon.Error); * }*/ mutex.Close(); }
/// <summary> /// Shows dialog /// </summary> /// <param name="listView"></param> public void Show(ListView listView, IntPtr Handle) { ListCtrl = listView; comboBoxColumns.Items.Clear(); foreach (ColumnHeader header in ListCtrl.Columns) { comboBoxColumns.Items.Add(header.Text); } comboBoxColumns.SelectedIndex = 0; foreach (ListViewItem item in ListCtrl.Items) { item.Selected = false; } buttonFind.Enabled = false; CallerHandle = Handle; Win32API.SetWindowPos(this.Handle, Win32API.HWND_TOPMOST, 0, 0, 0, 0, Win32API.SWP_NOMOVE | Win32API.SWP_NOSIZE); base.Show(); }