AM电脑吧 - Win10精简版系统_Win11精简版_Win7旗舰版

Yes
查看: 3131|回复: 1
收起左侧

[其它] QQ找茬辅助工具

[复制链接]
ampc8224

签到天数: 230 天

[LV.7]七个CPU

id dmqhcx88 发表于 2011-08-18 23:54:15


工具是采用找色的原理,速度比较慢,有兴趣的朋友可以优化下,


  1. #include <WinAPIEx.au3>
  2. #include <WinAPI.au3>
  3. #include <ButtonConstants.au3>
  4. #include <ComboConstants.au3>
  5. #include <GUIConstantsEx.au3>
  6. #include <StaticConstants.au3>
  7. #include <WindowsConstants.au3>
  8. Opt("PixelCoordMode", 2)
  9. Opt("MouseCoordMode", 2)
  10. Opt("GUIOnEventMode", 1)
  11. HotKeySet("{f12}", "_change_color")
  12. HotKeySet("{esc}", "tuichu")
  13. Global $g_color, $g_hotkey
  14. Global $sysfile = @ScriptDir & "\找茬辅助配置文件.ini"
  15. Global $color_list[5][2] = [["红", 0x0000ff],["绿", 0x00ff00],["蓝", 0xff0000],["黑", 0],["白", 0xffffff]]
  16. $g_color = IniRead($sysfile, "settings", "color", "蓝")
  17. $g_hotkey = IniRead($sysfile, "settings", "hotkey", "F5")
  18. HotKeySet("{" & $g_hotkey & "}", "test")

  19. #Region ### START Koda GUI section ###
  20. $Form1_1 = GUICreate("QQ找茬辅助工具    ", 484, 102, 301, 184)
  21. GUISetOnEvent($GUI_EVENT_CLOSE, "tuichu")
  22. $Group1 = GUICtrlCreateGroup("设置", 8, 8, 457, 57)
  23. $Label1 = GUICtrlCreateLabel("提示线颜色:", 24, 32, 67, 17)
  24. $Combo_color = GUICtrlCreateCombo("", 96, 28, 49, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
  25. GUICtrlSetData(-1, "红|蓝|黑|白|绿", $g_color)
  26. GUICtrlSetOnEvent(-1, "mygui")
  27. $Label2 = GUICtrlCreateLabel("快捷键:", 152, 32, 52, 17)
  28. $Combo_hotkey = GUICtrlCreateCombo("", 200, 28, 57, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
  29. GUICtrlSetData(-1, "F2|F3|F4|F5|F6|F7|F8|F9|F10", $g_hotkey)
  30. GUICtrlSetOnEvent(-1, "mygui")
  31. $Checkbox_move_win = GUICtrlCreateCheckbox("自动调整窗口", 272, 30, 97, 17)
  32. GUICtrlSetState(-1, IniRead($sysfile, "settings", "fixwinpos", 1))
  33. GUICtrlSetOnEvent(-1, "mygui")
  34. $Button1 = GUICtrlCreateButton("查找", 375, 28, 75, 22)
  35. GUICtrlSetOnEvent(-1, "test")
  36. GUICtrlCreateGroup("", -99, -99, 1, 1)
  37. $Label3 = GUICtrlCreateLabel("AM电脑吧  https://www.ampc8.com", 8, 75, 289, 20)
  38. GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
  39. GUICtrlSetColor(-1, 0x0000FF)
  40. $Label4 = GUICtrlCreateLabel("提示:游戏中按F12快速切换颜色", 280, 75, 189, 20)
  41. GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
  42. GUICtrlSetColor(-1, 0x008000)
  43. GUISetState(@SW_SHOW)
  44. #EndRegion ### END Koda GUI section ###
  45. While 1
  46. Sleep(100)
  47. WEnd
  48. Func mygui()
  49. Switch @GUI_CtrlId
  50.   Case $Checkbox_move_win
  51.    $_is_move = GUICtrlGetState($Checkbox_move_win)
  52.    IniWrite($sysfile, "settings", "fixwinpos", $_is_move)
  53.   Case $Combo_color
  54.    $g_color = GUICtrlRead($Combo_color)
  55.    IniWrite($sysfile, "settings", "color", $g_color)
  56.   Case $Combo_hotkey
  57.    HotKeySet("{" & $g_hotkey & "}")
  58.    $g_hotkey = GUICtrlRead($Combo_hotkey)
  59.    IniWrite($sysfile, "settings", "hotkey", $g_hotkey)
  60.    HotKeySet("{" & $g_hotkey & "}", "test")
  61. EndSwitch
  62. EndFunc   ;==>mygui
  63. Func _change_color()
  64. $_i = Random(0, 4, 1)
  65. $g_color = $color_list[$_i][0]
  66. GUICtrlSetData($Combo_color, "红|蓝|黑|白|绿", $g_color)
  67. test()
  68. EndFunc   ;==>_change_color
  69. Func test()
  70. WinClose('[title:mygui;class:AutoIt v3 GUI]')
  71. $_winhandle = WinGetHandle('[title:大家来找茬;class:#32770]')
  72. If @error Then
  73.   TrayTip("", "找不到游戏窗口", 5)
  74.   Return
  75. EndIf
  76. WinActivate($_winhandle)
  77. $_pre_color_a = PixelChecksum(15, 200, 30, 230, 1, $_winhandle)
  78. $_pre_color_b = PixelChecksum(205, 300, 230, 330, 1, $_winhandle)
  79. $_game_win_pos = WinGetPos($_winhandle)
  80. $_now_mouse_pos = MouseGetPos()
  81. If $_now_mouse_pos[0] > 505 Then
  82.   $_mygui = GUICreate("mygui", 490, 435, $_game_win_pos[0] + 6, $_game_win_pos[1] + 192, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
  83. Else
  84.   $_mygui = GUICreate("mygui", 490, 435, $_game_win_pos[0] + 516, $_game_win_pos[1] + 192, $WS_POPUP, $WS_EX_LAYERED + $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW)
  85. EndIf
  86. GUISetBkColor(0xABCDEF)
  87. WinSetOnTop($_mygui, "", 1)
  88. $hdc = _WinAPI_GetDC($_mygui)
  89. GUISetState()
  90. WinActivate($_winhandle)
  91. _API_SetLayeredWindowAttributes($_mygui, 0xABCDEF)
  92. _WinAPI_ReleaseDC($_mygui, $hdc)
  93. $hPen = _WinAPI_CreatePen($PS_SOLID, 2, _get_color_hex($g_color))
  94. $obj_orig = _WinAPI_SelectObject($hdc, $hPen)
  95. Local $_range_pos[2] = [15, 195], $_pre_pos[2] = [0, 0]
  96. If @error Then Return
  97. For $_i = 10 To 500 Step 10
  98.   For $_j = 195 To 630 Step 5
  99.    If $_i > 505 Or $_j > 636 Then Return
  100.    If PixelGetColor($_i, $_j, $_winhandle) <> PixelGetColor($_i + 509, $_j, $_winhandle) Then
  101.     _WinAPI_DrawLine($hdc, $_i - 13, $_j - 194, $_i - 5, $_j - 196)
  102.    EndIf
  103.   Next
  104. Next
  105. Do
  106.   Sleep(100)
  107.   If GUICtrlRead($Checkbox_move_win) == 1 Then
  108. ;~    WinActivate($_winhandle)
  109.    $_now_mouse_pos = MouseGetPos()
  110.    $_now_point = DllStructCreate("int " & $_now_mouse_pos[0] & ";int " & $_now_mouse_pos[1])
  111. ;~   #cs
  112.    $_now_win_pos = WinGetPos($_mygui)
  113.    If $_now_mouse_pos[1] < 192 Or $_now_mouse_pos[1] > 640 Then ContinueLoop
  114.    If $_now_mouse_pos[0] < 506 And $_now_win_pos[0] < 506 Then
  115.     WinMove($_mygui, "", $_game_win_pos[0] + 516, $_game_win_pos[1] + 192)
  116.    ElseIf $_now_mouse_pos[0] > 506 And $_now_win_pos[0] > 506 Then
  117.     WinMove($_mygui, "", $_game_win_pos[0] + 6, $_game_win_pos[1] + 192)
  118.    EndIf
  119.   EndIf
  120. ;~   #ce
  121. Until PixelChecksum(15, 200, 30, 230, 1, $_winhandle) <> $_pre_color_a And $_pre_color_b <> PixelChecksum(205, 300, 230, 330, 1, $_winhandle)
  122. GUIDelete($_mygui)
  123. EndFunc   ;==>test
  124. Func _get_color_hex($_content)
  125. For $_i = 0 To 4
  126.   If $color_list[$_i][0] == $_content Then Return $color_list[$_i][1]
  127. Next
  128. EndFunc   ;==>_get_color_hex
  129. Func findtezhengdian($_to_opr_win_handle = "", $firstco = 16317440, $xra = 1, $yra = 0, $secondco = 0, $xrb = -8, $yrb = 1, $thirdco = 0, $a = 10, $b = 50, $c = 640, $d = 500, $seccoa = 0, $seccob = 0, $seccoc = 0)
  130. $aa = $a
  131. $dd = $d
  132. $coapos = PixelSearch($a, $b, $c, $d, $firstco, 1)
  133. If @error Then
  134.   SetError(1)
  135.   Return 0
  136. EndIf
  137. $cob = PixelGetColor($coapos[0] + $xra, $coapos[1] + $yra)
  138. $coc = PixelGetColor($coapos[0] + $xrb, $coapos[1] + $yrb)
  139. While $cob <> $secondco Or $coc <> $thirdco
  140.   $a = $coapos[0] + 1
  141.   $b = $coapos[1]
  142.   $d = $coapos[1]
  143.   If $a > $c Then
  144.    $a = $aa
  145.    $b = $coapos[1] + 1
  146.    $d = $dd
  147.    If $b > $d Then
  148.     SetError(1)
  149.     Return 0
  150.    EndIf
  151.   EndIf
  152.   $coapos = PixelSearch($a, $b, $c, $d, $firstco, 1)
  153.   If @error Then
  154.    Dim $coapos[2]
  155.    $coapos[0] = $c
  156.    $coapos[1] = $b
  157.   Else
  158.    $cob = PixelGetColor($coapos[0] + $xra, $coapos[1] + $yra)
  159.    $coc = PixelGetColor($coapos[0] + $xrb, $coapos[1] + $yrb)
  160.   EndIf
  161. WEnd
  162. Return $coapos
  163. EndFunc   ;==>findtezhengdian
  164. Func _reg_get_string($_the_info, $_the_reg_exp)
  165. Local $_sting_reg_exp
  166. If $_the_info == "" Or $_the_reg_exp == "" Then Return SetError(1, 1, 0)
  167. $_sting_reg_exp = StringRegExp($_the_info, $_the_reg_exp, 1)
  168. If @error Then Return SetError(1, 1, 0)
  169. Return $_sting_reg_exp[0]
  170. EndFunc   ;==>_reg_get_string
  171. Func showtishi($neirong)
  172. ConsoleWrite($neirong & @CRLF)
  173. EndFunc   ;==>showtishi
  174. Func showmsg($detail, $chaoshi = 99999)
  175. MsgBox(262144 + 64, "提示", $detail, $chaoshi)
  176. EndFunc   ;==>showmsg
  177. Func tuichu()
  178. Exit
  179. EndFunc   ;==>tuichu
  180. Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
  181. Local Const $AC_SRC_ALPHA = 1
  182. Local Const $ULW_ALPHA = 2
  183. Local Const $LWA_ALPHA = 0x2
  184. Local Const $LWA_COLORKEY = 0x1
  185. If Not $isColorRef Then
  186.   $i_transcolor = Hex(String($i_transcolor), 6)
  187.   $i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
  188. EndIf
  189. Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
  190. Select
  191.   Case @error
  192.    Return SetError(@error, 0, 0)
  193.   Case $Ret[0] = 0
  194.    Return SetError(4, 0, 0)
  195.   Case Else
  196.    Return 1
  197. EndSelect
  198. EndFunc   ;==>_API_SetLayeredWindowAttributes
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?验证注册

x

评分

参与人数 1硬盘 +10 带宽 +10 收起 理由
ampc84 admin + 10 + 10 原创内容,再接再厉.

本文地址: https://www.ampc8.com/thread-3080-1-1.html
上一篇:XP-OEM修改器
下一篇:宽带连接生成器(XP用)
回复

举报

ampc84

签到天数: 15 天

[LV.4]四枚内存条

id ②號 发表于 2011-08-19 00:17:48
支持原创,谢谢分享 。
回复

举报

您需要登录后才可以回帖 登录 | 验证注册

Powered by AMpc8.Com (晋ICP备13003365号ghs 晋公网安备 14090202000112号 |GMT+8, 2025/5/1 03:45 | A
快速回复 返回顶部 返回列表