private void listView1_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { ListView listbox = sender as ListView; if (!listbox.SelectedItems[0].Text.ToLower().Contains("account")) { foreach (Panel panel in panel4.Controls.OfType <Panel>()) { if (listbox.SelectedItems[0].Text.Contains(panel.Controls.OfType <TextBox>().ToList()[0].Text) && panel.Controls.OfType <TextBox>().ToList()[0].Text != "") { panel.Controls.OfType <Button>().ToList()[0].PerformClick(); } } } foreach (IntPtr hWnd in ListHandles) { if (GetHwnd.Get_WindowTextByHandle(hWnd).Contains(listbox.SelectedItems[0].Text)) { ShowWindow(hWnd, WindowShowStyle.ShowNormal); //ShowWindow(hWnd, WindowShowStyle.Show); SetForegroundWindow(hWnd); } } } } catch (Exception ex) { } }
private void listView1_MouseClick(object sender, MouseEventArgs e) { try { ListView listview = sender as ListView; foreach (IntPtr hWnd in ListHandles) { if (GetHwnd.Get_WindowTextByHandle(hWnd).Contains(listview.SelectedItems[0].Text)) { label3.Text = GetHwnd.Get_WindowAuthCode(hWnd); } } } catch (Exception ex) { } }
private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { //RefreshListOfAuths(); ListView listbox = sender as ListView; foreach (IntPtr hWnd in ListHandles) { try { string windowText = GetHwnd.Get_WindowTextByHandle(hWnd); if (windowText.Contains(listbox.SelectedItems[0].Text)) { string CODE = GetHwnd.Get_WindowAuthCode(hWnd); label3.Text = CODE; Clipboard.SetText(CODE); } } catch (Exception ex) { } } }
private void button2_Click(object sender, EventArgs e) { try { foreach (IntPtr hWnd in ListHandles) { foreach (ListViewItem item in listView1.Items) { if (GetHwnd.Get_WindowTextByHandle(hWnd).Contains(item.Text.ToString())) { if (hWnd == IntPtr.Zero) { //Console.WriteLine("Window not found"); return; } SendMessage(hWnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero); } } } } catch (Exception ex) { } RefreshListOfAuths(); }