public Mainmenu() { InitializeComponent(); this.StyleManager = metroStyleManager1; this.TopMost = true; Overlay(); main = this; SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS); RegisterHotKey(this.Handle, MYACTION_HOTKEY_ID, 2, (int)Keys.Insert); }
private void metroButton1_Click(object sender, EventArgs e) { Process[] processes = Process.GetProcessesByName("BlackDesert64"); Process p = processes.FirstOrDefault(); if (p != null) { Mainmenu n = new Mainmenu(); Console.WriteLine(Application.OpenForms[0].ToString()); this.Visible = false; ShowWindow(processes[0].MainWindowHandle, 9); SetForegroundWindow(processes[0].MainWindowHandle); n.Show(); } else { MetroMessageBox.Show(this, "Error: Black Desert Online is not open!"); Application.Exit(); } }