private void button3_Click_1(object sender, EventArgs e) { List <WindowInfo> list = GetApplication.GetRunApplicationInfo(this); string pId = "0"; list.ForEach(process => { // if (process.szWindowName == "微信") { listBox1.Items.Add(process.hWnd + "=====cls:" + process.cls + "=====szWindowName:" + process.szWindowName + "=====PID:" + process.PID + "=====AppPath:" + process.AppPath + "=====Marks:" + process.marks ); TITLEBARINFO pti = new TITLEBARINFO(); pti.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(pti); bool result = GetTitleBarInfo((IntPtr)process.hWnd, ref pti);//标题栏的按钮,最大化最小化,关闭 TreeNode node = new TreeNode(); node.Text = process.szWindowName + "--" + process.cls + "--" + pti.rgstate[0].ToString(); node.Tag = process.hWnd;// process.cls; pId = process.PID; RefreshChildNode(treeView1, node, "0"); GetHandleNode(process.szWindowName, node); } }); treeView1.ExpandAll(); }
private void button2_Click(object sender, EventArgs e) { List <string> list = GetApplication.GetRunApplication(this); list.ForEach(process => { listBox1.Items.Add(process); }); }
private void button5_Click(object sender, EventArgs e) { List <WindowInfo> list = GetApplication.GetAllDesktopWindows(); list.ForEach(process => { // if (process.szWindowName == "微信") { listBox1.Items.Add(process.hWnd + "=" + process.cls + "=" + process.szWindowName); } }); }