private void btnPickWindow_Click_1(object sender, EventArgs e) { hk = new cThreadHook(this, IntPtr.Zero); hk.EnableFindingHook(); hk.Start(); tscSelectWindow.Checked = true; Mode = true; TopMost = true; }
public void StartHook() { try { IntPtr TargetWindow = new IntPtr(Int32.Parse(edtHandle.Text, System.Globalization.NumberStyles.HexNumber)); hk = new cThreadHook(this, TargetWindow); hk.EnableListeningHook(); hk.Start(); } catch (Exception er) { if (er is FormatException) { MessageBox.Show("Неправильный дескриптор", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(er.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } throw new FormatException(); } }