在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
c# 免注册调用大漠插件100%完美识别文字下载:https://download.csdn.net/download/xxq931123/10875122 绑定 模式:http://zy.anjian.com/?action-viewthread-tid-239647
test 发QQ消息: public MainForm() { InitializeComponent(); dm = new CDmSoft(""); this.WindowState = FormWindowState.Minimized; // this.StartPosition = FormStartPosition.CenterScreen; } CDmSoft dm; private void MainForm_Load(object sender, EventArgs e) { int hwd = dm.FindWindow("TXGuiFoundation", "");//CabinetWClass Text = "" + hwd; if (hwd > 0) { int dm_ret = dm.BindWindowEx(hwd, "gdi", "windows", "windows", "dx.public.fake.window.min", 0); System.Threading.Thread.Sleep(1000); if (dm_ret == 0) { MessageBox.Show("failed"); return; } // MessageBox.Show( dm.GetWindowTitle(hwd)); dm.MoveWindow(hwd, 1, 1); // System.Threading.Thread.Sleep(2000); dm.SetWindowSize(hwd, 694,615); //dm.SetWindowText(hwd, "hello"); dm.MoveTo(113, 263); dm.LeftClick(); dm.delay(1000); dm.MoveTo(467, 540); dm.LeftClick(); Thread.Sleep(50); dm.SetWindowState(hwd, 1);//激活窗口 dm.SetWindowState(hwd, 8); Thread.Sleep(50); dm.SendString2(hwd, "hello你好"); Thread.Sleep(200); dm.KeyDown(13);//ENTER dm.KeyUp(13); dm.SetWindowState(hwd, 9);//设置为非活动窗口 //dm.SetWindowState(hwd, 2);//最小化 dm.UnBindWindow();//解绑窗口 } else { MessageBox.Show("can not find window"); } } }
查找微信和QQ的聊天窗口,根据窗口类名来进行模糊查找,然后得到窗口句柄,根据窗口句柄得到窗口的标题、类名信息(QQ聊天窗口的类名是:TXGuiFoundation,微信的聊天窗口类名是:ChatWnd): var list = new List<int>(); list.AddRange(_dmsoft.EnumWindow(0, "", "TXGuiFoundation", 18).Split(',').Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => Convert.ToInt32(x))); list.AddRange(_dmsoft.EnumWindow(0, "", "ChatWnd", 18).Split(',').Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => Convert.ToInt32(x))); windInfoBindingSource.DataSource = list.Select(x => new WindInfo() { Handle = x, ClassName = _dmsoft.GetWindowClass(x), Title = _dmsoft.GetWindowTitle(x), }).ToList();
或者枚举所有窗口: int hwd = dm.FindWindow("TXGuiFoundation", "");//CabinetWClass List<WindowInfo> listWindows = new List<WindowInfo>(); string[] sList = dm.EnumWindow(0, "", "TXGuiFoundation", 18).Split(',');//.Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => Convert.ToInt32(x))); foreach (string s in sList) { if (!string.IsNullOrEmpty(s)) { hwd = Convert.ToInt32(s); WindowInfo wd = new WindowInfo(); wd.ClassName = dm.GetWindowClass(hwd); wd.Handle=hwd; wd.Title= dm.GetWindowTitle(hwd); listWindows.Add(wd); } }
public int Handle;
普通窗口不用激活、设置前置窗口也能模拟 dm_bindRet = dm.BindWindowEx(hwd, "gdi", "windows3", "windows", "dx.public.fake.window.min", 0); 最后说下大漠缺点就是容易报毒。。。。。。。。。。。。
能考大漠API:https://www.cnblogs.com/xiongyunsheng/p/11254333.html |
请发表评论