Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string HeroName  = comboBox1.Text.ToString();
            var    LoLClient = DM.FindWindow("", "League of Legends");

            DM.BindWindow(LoLClient, "gdi", "windows3", "normal", 1);
            DM.MoveTo(860, 97);
            DM.LeftClick();
            DM.Capture(0, 0, 2000, 2000, "1.bmp");
            int isExsit = -1;
            //Enter hero name X Y;
            int    x = 784, y = 100;
            object x1, y2;

            while (true)
            {
                isExsit = DM.FindPic(0, 0, 2000, 2000, "Icon.bmp", "000000", 0.9, 0, out x1, out y2);
                if (isExsit >= 0)
                {
                    DM.MoveTo(860, 97);
                    Thread.Sleep(300);
                    DM.LeftClick();
                    Thread.Sleep(300);
                    foreach (int key in Hero[HeroName])
                    {
                        DM.KeyPress(key);
                    }
                    DM.MoveTo(370, 163);
                    Thread.Sleep(500);
                    DM.LeftClick();
                }
            }
        }
Example #2
0
 public void Start()
 {
     status = true;
     ProgressChanged(this, status);
     tokenSource = new CancellationTokenSource();
     var token = tokenSource.Token;
     var task  = Task.Factory.StartNew(() => {
         int hwnd = dm.FindWindow("Heroes of the Storm", "");
         dm.BindWindow(hwnd, "gdi", "windows", "windows", 0);
         for (int i = 0; i < count; i++)
         {
             string[] words = phrase.Split('#');
             foreach (var word in words)
             {
                 if (token.IsCancellationRequested)
                 {
                     Console.WriteLine("Abort mission success!");
                     return;
                 }
                 int ret1 = dm.SendString(hwnd, $"{word}");
                 if (ret1 == 0)
                 {
                     MessageBox.Show("失败");
                     break;
                 }
                 dm.KeyPress(13); // Enter
                 Thread.Sleep(interval);
                 Console.WriteLine(status);
             }
         }
         status = false;
         ProgressChanged(this, status);
     }, tokenSource.Token);
     //tokenSource.Cancel();
 }
Example #3
0
 //判断模拟器是否开启
 bool FindEmu(string game)
 {
     for (int i = 0; i < 4; i++)
     {
         if (dm.FindWindow("", game) != 0)
         {
             return(true);
         }
         dm.delay(500);
     }
     return(false);
 }
Example #4
0
        // 绑定模拟器
        public void BindEmu()
        {
            int top_Hwnd = dm.FindWindow("", game);

            GameMsg("顶层句柄为:" + top_Hwnd.ToString());
            string child_Hwnd = dm.EnumWindow(top_Hwnd, "", "", 4);

            GameMsg("子句柄为:" + child_Hwnd);
            int dm_ret = dm.BindWindowEx(int.Parse(child_Hwnd), "dx.graphic.opengl", "windows", "windows", "", 0);

            if (dm_ret == 1)
            {
                GameMsg("绑定成功");
            }
            else
            {
                GameMsg("绑定失败" + "错误代码:" + dm_ret.ToString());
            }
        }
Example #5
0
        public static bool BindWindow()
        {
            dmsoft dm = GetDm();

            hwnd = dm.FindWindow("", "poi");
            if (hwnd == 0)
            {
                Outputs.Log("未找到poi浏览器!");
                return(false);
            }
            Outputs.Log("poi窗口句柄为:" + hwnd.ToString());
            int res = dm.BindWindow(hwnd, "normal", "windows", "windows", 0);

            if (res != 1)
            {
                Outputs.Log("窗口绑定失败");
                return(false);
            }
            Outputs.Log("窗口绑定成功");
            return(true);
        }
Example #6
0
        public int FindWindow()
        {
            int hwnd = dm.FindWindow("UnityWndClass", "Ant野菜部落2019 v5.0.1 - ");

            return(hwnd);
        }
Example #7
0
 public int FindWindow(string windowClass, string title)
 {
     return(dm.FindWindow(windowClass, title));
 }
 /// <summary>
 /// 查找顶层窗口
 /// </summary>
 /// <param name="hwnd"></param>
 /// <returns></returns>
 public static int FindTopForm(string className, string title)
 {
     return(mydm.FindWindow(className, title));
 }
Example #9
0
 public int FindWindow(string class_name, string title_name)
 {
     return(dm.FindWindow(class_name, title_name));
 }