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) { } }
void RefreshListOfAuths() { listView1.Items.Clear(); EnumWindows((hWnd, lParam) => { if (/*(IsWindowVisible(hWnd) && GetWindowTextLength(hWnd) != 0) && */ GetWindowText(hWnd).StartsWith(name)) { ListHandles.Add(hWnd); listView1.Items.Add(GetHwnd.Get_WindowNickname(hWnd)); } return(true); }, IntPtr.Zero); string itemsStr = ""; foreach (object item in listView1.Items) { itemsStr += item.ToString() + ";"; } foreach (Panel panel in panel4.Controls.OfType <Panel>()) { if (panel.Controls.OfType <CheckBox>().ToList()[0].Checked) { string acc = panel.Controls.OfType <TextBox>().ToList()[0].Text; if (!itemsStr.ToLower().Contains(acc.ToLower())) { listView1.Items.Add("[ " + acc + " ]"); } } } }
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(); }