51Testing软件测试论坛

标题: 关于按键精灵大漠插件后台鼠标只能在前台运行的问题,如何解决? [打印本页]

作者: 测试积点老人    时间: 2022-6-14 10:06
标题: 关于按键精灵大漠插件后台鼠标只能在前台运行的问题,如何解决?
星际争霸2 大漠和361插件后台鼠标无效
在前台能用运行,但是打开其他软件时后台鼠标停了(后台键盘脚本可以来)
用大漠绑定测试工具设置公共属性测试成功dx.public.active.api|dx.public.active.message
但是脚本运行还是存在后台鼠标无效的情况,
  1. hwnd = Plugin.Window.Find("StarCraft II", "《星际争霸II》")
  2. TracePrint hwnd
  3. //hwnd = dm.GetForegroundFocus()
  4. //hwnd = dm.GetMousePointWindow()
  5. //这个返回的就是那个句柄 这里存到变量hwnd里

  6. Call Plugin.RegDll.Reg("C:\test_game\\dm.dll")
  7. Set dm = createobject("dm.dmsoft")
  8. ver = dm.Ver()
  9. TracePrint ver
  10. dm_ret = dm.Reg("yonghu84f875b03fb0d5c536a56a631156628a","yk9406696") // abcdefg是您的注册码. 在大漠插件网站后台可以直接获取.

  11. if dm_ret <> 1 then

  12.    messagebox "注册失败,返回值是:"&dm_ret

  13.    endscript

  14. end if

  15. mouse="dx.mouse.position.lock.api|dx.mouse.position.lock.message|dx.mouse.focus.input.api|dx.mouse.focus.input.message|dx.mouse.clip.lock.api|dx.mouse.input.lock.api|dx.mouse.state.api|dx.mouse.state.message|dx.mouse.api|dx.mouse.cursor|dx.mouse.raw.input|dx.mouse.input.lock.api2|dx.mouse.input.lock.api3"
  16. public1="dx.public.active.api|dx.public.active.message|dx.public.active.api2|dx.public.anti.api|dx.mouse.position.lock.api|dx.mouse.position.lock.message|dx.mouse.focus.input.api|dx.mouse.focus.input.message|dx.mouse.clip.lock.api|dx.mouse.input.lock.api|dx.mouse.state.api|dx.mouse.state.message|dx.mouse.api|dx.mouse.cursor|dx.mouse.raw.input|dx.mouse.input.lock.api2|dx.mouse.input.lock.api3"
  17. public2 = "dx.public.active.api|dx.public.active.message|dx.public.fake.window.min|dx.public.disable.window.show"
  18. dm_ret = Plugin.WindowEx5_01.GetWindowState(hwnd, 1)//用361插件在绑定前激活窗口
  19. If dm_ret = 0 Then
  20.     MessageBox "还没有激活!"
  21. Else
  22.     MessageBox "已经激活了! "
  23. End If
  24. Call Plugin.WindowEx5_01.SetWindowState(hwnd, 1)
  25. dm_ret = Plugin.WindowEx5_01.GetWindowState(hwnd, 1)
  26. If dm_ret = 0 Then
  27.     MessageBox "激活失败!"
  28. Else
  29.     MessageBox "激活成功! "
  30. End If
  31. Delay 500
  32. dm_ret = dm.BindWindowEx(hwnd,"dx2","windows3","windows",pulic2,0)
  33. //dm_ret=1
  34. If dm_ret = 0 Then
  35.     MessageBox "绑定失败!"
  36. Else
  37.     MessageBox "绑定成功! "
  38. End If
  39. //获取标题栏
  40. //title = dm.GetWindowTitle(hwnd)
  41. //获取窗口分辨率
  42. //dm_ret = dm.GetClientSize(hwnd, w, h)
  43. //TracePrint "宽度:"&w&",高度:"&h
  44. //Plugin.D361Wnd.SetFakeActive
  45. Plugin.WindowEx5_01.SetFakeActive hwnd, 0
  46. //循环一
  47. Do
  48.     //Exit do
  49.     Delay 50
  50.     dm.moveto 684,41  
  51.     Delay 50
  52.     dm.leftclick
  53.     Delay 50
  54.     dm.moveto 55,691
  55.     Delay 50
  56.     dm.leftclick
  57.     Delay 50
  58.    
  59.     Delay 50
  60.     dm.moveto 684,41
  61.     Delay 50
  62.     dm.leftclick
  63.     Delay 50
  64.     dm.moveto 135,698
  65.     Delay 50
  66.     dm.leftclick
  67.     Delay 50
  68.    
  69.     dm.moveto 684,41
  70.     Delay 50
  71.     dm.leftclick
  72.     Delay 50
  73.     dm.moveto 55,764
  74.     Delay 50
  75.     dm.leftclick
  76.     Delay 50
  77.    
  78.     dm.moveto 684,41
  79.     Delay 50
  80.     dm.leftclick
  81.     Delay 50
  82.     dm.moveto 121,787
  83.     Delay 50
  84.     dm.leftclick
  85.     Delay 50
  86.    
  87.     dm.moveto 684,41
  88.     Delay 50
  89.     dm.leftclick
  90.     Delay 50
  91.     dm.moveto 182,763
  92.     Delay 50
  93.     dm.leftclick
  94.     Delay 50
  95.    
  96.     dm.moveto 802,522
  97.     Delay 50
  98.     dm.leftclick  
  99.     Delay 50
  100.     dm.moveto 186,660
  101.     Delay 50
  102.     dm.leftclick  
  103.     Delay 50
  104.     dm.moveto 165,738
  105.     Delay 50
  106.     dm.leftclick  
  107.     Delay 50
  108. Loop
  109. //循环二
  110. Do
  111.     Exit do
  112.     Delay 50
  113.     dm.moveto 612,31
  114.     Delay 50
  115.     dm.leftclick
  116.     Delay 50
  117.     dm.moveto 48,588
  118.     Delay 50
  119.     dm.leftclick
  120.     Delay 50
  121.    
  122.     Delay 50
  123.     dm.moveto 612,31
  124.     Delay 50
  125.     dm.leftclick
  126.     Delay 50
  127.     dm.moveto 47,648
  128.     Delay 50
  129.     dm.leftclick
  130.     Delay 50
  131.    
  132.     dm.moveto 612,31
  133.     Delay 50
  134.     dm.leftclick
  135.     Delay 50
  136.     dm.moveto 114,591
  137.     Delay 50
  138.     dm.leftclick
  139.     Delay 50
  140.    
  141.     dm.moveto 612,31
  142.     Delay 50
  143.     dm.leftclick
  144.     Delay 50
  145.     dm.moveto 104,667
  146.     Delay 50
  147.     dm.leftclick
  148.     Delay 50
  149.    
  150.     dm.moveto 612,31
  151.     Delay 50
  152.     dm.leftclick
  153.     Delay 50
  154.     dm.moveto 154,644
  155.     Delay 50
  156.     dm.leftclick
  157.     Delay 50
  158.    
  159.     dm.moveto 714,443
  160.     Delay 50
  161.     dm.leftclick  
  162.     Delay 50
  163.     dm.moveto 216,571
  164.     Delay 50
  165.     dm.leftclick  
  166.     Delay 50
  167.     dm.moveto 206,644
  168.     Delay 50
  169.     dm.leftclick  
  170.     Delay 50
  171. loop
  172. //使用完后,释放窗口 不0释放鼠标键盘没法操作
  173. //dm_ret = dm.UnBindWindow()


复制代码



作者: kallinr    时间: 2022-6-15 12:03
可能是软件问题
作者: qqq911    时间: 2022-6-15 12:37
应该是要求必须置顶
作者: 海海豚    时间: 2022-6-15 14:19
有些窗口在没有激活的时候,是不可以用按键自带的后台插件开控制的。所以你需要用假激活,来一直保持窗口是激活状态。
作者: 郭小贱    时间: 2022-6-15 14:37
应该不能后台运行吧?
作者: jingzizx    时间: 2022-6-15 16:11
是不是有内部控制




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2