private void mephobiaButton4_Click(object sender, EventArgs e) { try { string realmlist = "Set realmlist " + RealmlistAddressDataList[listBox1.SelectedItem.ToString()]; StreamWriter openFile = new StreamWriter(RealmlistPathDataList[listBox1.SelectedItem.ToString()]); openFile.WriteLine(realmlist); openFile.Close(); } catch { MessageBox.Show("Invalid realmlist.wtf not found"); } try { if (Settings.Default.clear_cache) { string MainDirectory = WoWExePathDataList[listBox1.SelectedItem.ToString()].Replace("Wow.exe", ""); if (Directory.Exists(MainDirectory + "\\Cache")) { Directory.Delete(MainDirectory + "\\Cache", true); } } Process process = Process.Start(WoWExePathDataList[listBox1.SelectedItem.ToString()]); string accountName = comboBox1.Text.ToString(); Thread.Sleep(600); //! Run this code in a new thread so the main form does not freeze up. new Thread(() => { if (Settings.Default.auto_account_login) { try { Thread.CurrentThread.IsBackground = true; while (!process.WaitForInputIdle()) { ; } Thread.Sleep(2000); foreach (char accNameLetter in accountName) { SendMessage(process.MainWindowHandle, WM_CHAR, new IntPtr(accNameLetter), IntPtr.Zero); Thread.Sleep(30); } //! Switch to password field if (!String.IsNullOrWhiteSpace(MyFunctions.base64Decode(AccountsDataList[comboBox1.SelectedItem.ToString()]))) { SendMessage(process.MainWindowHandle, WM_KEYUP, new IntPtr(VK_TAB), IntPtr.Zero); SendMessage(process.MainWindowHandle, WM_KEYDOWN, new IntPtr(VK_TAB), IntPtr.Zero); foreach (char accPassLetter in MyFunctions.base64Decode(AccountsDataList[comboBox1.SelectedItem.ToString()])) { SendMessage(process.MainWindowHandle, WM_CHAR, new IntPtr(accPassLetter), IntPtr.Zero); Thread.Sleep(30); } //! Login to account SendMessage(process.MainWindowHandle, WM_KEYUP, new IntPtr(VK_RETURN), IntPtr.Zero); SendMessage(process.MainWindowHandle, WM_KEYDOWN, new IntPtr(VK_RETURN), IntPtr.Zero); //! Login to char (disabled atm, will be used in next feature) //if (Settings.Default.LoginToChar) //{ // Thread.Sleep(1500); // SendMessage(process.MainWindowHandle, WM_KEYUP, new IntPtr(VK_RETURN), IntPtr.Zero); // SendMessage(process.MainWindowHandle, WM_KEYDOWN, new IntPtr(VK_RETURN), IntPtr.Zero); //} } Thread.CurrentThread.Abort(); } catch { Thread.CurrentThread.Abort(); } } }).Start(); } catch { MessageBox.Show("Invalid Wow.exe not found"); } this.WindowState = FormWindowState.Minimized; }