• 新浪微博:
  • 按键公众号 :
按键精灵电脑版
立即下载

软件版本:2014.06
软件大小:22.9M
更新时间:03-18

按键精灵安卓版
立即下载

软件版本:3.7.0
软件大小:46.2M
更新时间:03-02

按键精灵iOS版
立即下载

软件版本:1.7.7
软件大小:29.2M
更新时间:12-06

按键手机助手
立即下载

软件版本:3.7.7
软件大小:262M
更新时间:08-06

快捷导航

登录 后使用快捷导航
没有帐号? 注册

发新话题 回复该主题

内容自己看 [复制链接]

1#
Declare Function GetAsyncKeyState Lib "user32.dll" Alias "GetAsyncKeyState" (ByVal Key As Long) As Long

//控制变量
Dimenv 启动键, 删除线程




//测试代码,用于测试子窗效果
Hwnd = Plugin.Window.MousePoint()
Hwnd = Lib.API_窗口.窗口_取父窗口(Hwnd)
Set dm = createobject("dm.dmsoft")
a= 判断句柄(dm.EnumWindow(0,"vip专用","Button",1+2),hwnd)
Call Plugin.Bkgnd.LeftClick(a, 1, 1)
b= 判断句柄2(dm.EnumWindow(0,"VIP界面---使用仓库","Button",1+2),hwnd)
Call Plugin.Bkgnd.LeftClick(b, 1, 1)
MPC物品栏 = 判断句柄2(dm.EnumWindow(0, "MPC物品栏", "Button", 1 + 2), hwnd)
存储栏 = 判断句柄2(dm.EnumWindow(0, "存储物品栏", "Button", 1 + 2), hwnd)




//功能主代码
Sub 功能代码
Dim hwnd, ret, dm, hwnd2, 自线程ID, 物品, 怪物, 方向,VIP按钮,打开仓库按钮,MPC物品栏,存储栏,i,x,y,关闭
方向=1
自线程ID = GetThreadID()
set dm = createobject("dm.dmsoft")//创建大漠
hwnd = dm.GetMousePointWindow()//取得句柄
TracePrint hwnd
hwnd = Lib.API_窗口.窗口_取父窗口(hwnd)//取得操作层窗口(游戏接受鼠标键盘信息的那一层)
hwnd2=hwnd
hwnd = Lib.API_窗口.窗口_取父窗口(hwnd)//取得图像层窗口(游戏进行绘画的那一层窗口)
dm.MoveWindow hwnd,-10,-10//进行DX绑定时的一个伪操作
TracePrint dm.BindWindow(hwnd, "dx3", "windows", "windows", 0)//绑定
Delay 2000
//循环找图,捡宝石
物品 = "c:\魔域辅助\s.bmp"
怪物 = "c:\魔域辅助\l.bmp"
捡物次数 = 30
If Form1.CheckBox4.Value = 1 Then
怪物=怪物+"|"+"c:\魔域辅助\ls.bmp"
End If
If Form1.CheckBox3.Value = 1 Then
怪物=怪物+"|"+"c:\魔域辅助\j.bmp"
End If
If Form1.CheckBox5.Value = 1 Then
怪物=怪物+"|"+"c:\魔域辅助\d.bmp"
End If
If Form1.CheckBox6.Value = 1 Then
怪物=怪物+"|"+"c:\魔域辅助\lg.bmp"
End If


//功能循环

do
//第一步寻找物品,有就捡起来
dm.FindPic 0, 0, 1024, 768, 物品, "000000", 0.8, 1, intX, intY
TracePrint intx&"|"&inty
If intx > 0 and inty > 0 Then
Call Plugin.Bkgnd.LeftClick(Hwnd2, intx, inty)
Delay 3000
捡物次数=捡物次数+1
End If


//第二步包满存仓库处理
If 捡物次数>=30 Then
捡物次数=0
VIP按钮 = 判断句柄(dm.EnumWindow(0, "vip专用", "Button", 1 + 2), hwnd2)
Call Plugin.Bkgnd.LeftClick(VIP按钮, 1, 1)
打开仓库按钮=判断句柄2(dm.EnumWindow(0, "VIP界面---使用仓库", "Button", 1 + 2), hwnd2)
Call Plugin.Bkgnd.LeftClick(打开仓库按钮, 1, 1)
MPC物品栏 = 判断句柄2(dm.EnumWindow(0, "MPC物品栏", "Button", 1 + 2), hwnd2)
存储栏 = 判断句柄2(dm.EnumWindow(0, "存储物品栏", "Button", 1 + 2), hwnd2)
Delay 500
x = 15
y = 15//第一个格子坐标
For 4*9*6
Call Plugin.Bkgnd.LeftClick(MPC物品栏,15,15)
Delay 50
Call Plugin.Bkgnd.LeftClick(存储栏, 91,82)
Next
关闭 = 判断句柄2(dm.EnumWindow(0, "关闭", "Button", 1 + 2), hwnd2)
Call Plugin.Bkgnd.LeftClick(关闭, 1, 1)
Call Plugin.Bkgnd.rightClick(Hwnd2, 995,370)
End If


//第三步锁定怪物位置打怪,无怪四周转转

dm.FindPic 0, 0, 1024, 768, 怪物, "000000", 0.8, 1, intX, intY
If intx < 0 and inty < 0 Then
Select Case 方向
Case 1
For Form1.Slider1.Value
Call Plugin.Bkgnd.LeftClick(Hwnd2, 543,608)
Delay 1000
Next
方向=方向+1
Case 2
For Form1.Slider1.Value
Call Plugin.Bkgnd.LeftClick(Hwnd2, 995,370)
Delay 1000
Next
方向=方向+1
Case 3
For Form1.Slider1.Value
Call Plugin.Bkgnd.LeftClick(Hwnd2, 539,81)
Delay 1000
Next
方向=方向+1
Case 4
For Form1.Slider1.Value
Call Plugin.Bkgnd.LeftClick(Hwnd2, 29,337)
Delay 1000
Next
方向=1
End Select
//转完以后,再次寻找怪物位置,并移动到怪物点
dm.FindPic 0, 0, 1024, 768, 怪物, "000000", 0.8, 1, intX, intY
If intx > 0 and inty > 0 Then
Call Plugin.Bkgnd.LeftClick(Hwnd2, intx, inty)
Delay 2000
End If
Else
//有怪的情况下,直接打怪
Call Plugin.Bkgnd.RightClick(Hwnd2, intx+18, inty+48)
Delay 1000
End If

// 重复检查一次物品掉落情况
dm.FindPic 0, 0, 1024, 768, 物品, "000000", 0.8, 1, intX, intY
TracePrint intx&"|"&inty
If intx > 0 and inty > 0 Then
Call Plugin.Bkgnd.LeftClick(Hwnd2, intx, inty)
Delay 3000
捡物次数=捡物次数+1
End If


//第四步检测是否被停止线程操作,遇到停止操作则跳出循环
If 自线程ID = 删除线程 Then
删除线程 = 0
dm.UnBindWindow //释放对象,线程让它自然结束后,控制端再控制结束
Exit Do
End If
Loop

End Sub
Sub 注册
PutAttachment "c:\魔域辅助","*.*"
set ws=createobject("Wscript.Shell")
ws.run "regsvr32 c:\魔域辅助\dm.dll /s"
set ws=nothing
End Sub
Sub OnScriptLoad()
Call 注册
End Sub
Event Form1.Button1.Click
Dim list,ar
list = split(Form1.ListBox1.List, "|")
ar=split (list(Form1.ListBox1.ListIndex),">>")
删除线程 = Clng(ar(1))
Form1.Button1.Enabled=False
Delay 1500//给足够的时间让线程释放大漠对象,然后停止!
Form1.ListBox1.RemoveItem (Form1.ListBox1.ListIndex)
StopThread Clng(ar(1))
Form1.Button1.Enabled=True
End Event
//线程删除操作
SUB 控件操作SUB
Dim Hwnd, sText, i, Ar, At, 可运行
可执行=1
Hwnd = Plugin.Window.MousePoint()
Ar=split(Form1.ListBox1.List,"|")
For i = 0 To UBound (Ar)
At = split(Ar(i), ">>")
If clng(At(0)) = Hwnd Then
可执行 = 0
Exit For
End If
Next
If 可执行 = 0 Then
Form1.Button1.Enabled=False
删除线程 = Clng(At(1))
Delay 1500
StopThread Clng(At(1))
Form1.ListBox1.RemoveItem (i)
Form1.Button1.Enabled=True
Else
MessageBox "这个窗口你没有运行脚本。"
End If
End SUB
//线程开启操作
SUB 控件操作ADD
Dim Hwnd, sText, i, Ar, At, 可运行
可运行=1
Hwnd = Plugin.Window.MousePoint()
Ar=split(Form1.ListBox1.List,"|")
For i = 0 To UBound (Ar)
At = split(Ar(i), ">>")
If clng(At(0)) = Hwnd Then
可运行 = 0
Exit For
End If
Next
If 可运行 = 0 Then
MessageBox "请不要在同一个窗口运行多个线程!"
Else
set dm = createobject("dm.dmsoft")
call dm.GetClientSize(hwnd,w,h)
Set dm = nothing

If w = 1024 and h = 768 Then
sText = Plugin.Window.GetText(Hwnd)
Form1.ListBox1.AddItem (Hwnd & ">>" & BeginThread(功能代码) & ">>" & sText)
Else
MessageBox "我想弱弱的问一句,这是魔域窗口吗?魔域游戏窗口标准大小为:1024*768"
End If


End If
End SUB
Event Form1.LoadOver
Call 注册
Call Form1.ComboBox1.SelectChange
End Event
Event Form1.ComboBox1.SelectChange
Select Case Form1.ComboBox1.ListIndex
Case 0
启动键 = 112
Case 1
启动键 = 113
Case 2
启动键 = 114
Case 3
启动键 = 115
Case 4
启动键 = 116
Case 5
启动键 = 117
Case 6
启动键 = 118
Case 7
启动键 = 119
Case 8
启动键 = 120
Case 9
启动键 = 121
Case 10
启动键 = 122
Case 11
启动键 = 123
Case -1
MessageBox "错误的选项!"
Form1.ComboBox1.ListIndex=10
End Select
End Event
Event Form1.Timer1.Timer
If GetAsyncKeyState(启动键) <> 0 and 可操作 = 1 Then
可操作 = 0
CALL 控件操作ADD() //热键启动功能
End If
If GetAsyncKeyState(启动键) = 0 and 可操作 = 0 Then
可操作 = 1
End If
End Event
Event Form1.Timer2.Timer
If GetAsyncKeyState(46) <> 0 and 可操作2 = 1 Then //DEL单停功能键
可操作2 = 0
Call 控件操作SUB()
End If
If GetAsyncKeyState(46) = 0 and 可操作2 = 0 Then
可操作2 = 1
End If
End Event
Event Form1.CheckBox2.Click
Form1.CheckBox2.Value = 1
End Event
Event Form1.Slider1.Slide
Form1.Label4.Caption="范围:"&Form1.Slider1.Value
End Event
Event Form1.CheckBox1.Click
Form1.CheckBox1.Value=1
End Event
//判断一个一级子窗句柄集是否属于指定窗口的子窗口
Function 判断句柄(句柄枚举字符,窗口句柄)
Dim ar,i,hwnd
ar=split(句柄枚举字符,",")
For i = 0 To UBound(ar)
hwnd = Lib.API_窗口.窗口_取父窗口(clng(ar(i)))
If hwnd = 窗口句柄 Then
判断句柄=clng(ar(i))
Exit For
End If
Next
End Function
//判断二级子窗句柄集,是否属于指定窗口子窗口
Function 判断句柄2(句柄枚举字符,窗口句柄)
Dim ar, i, hwnd
窗口句柄=Lib.API_窗口.窗口_取父窗口(窗口句柄)
ar=split(句柄枚举字符,",")
For i = 0 To UBound(ar)
hwnd = Lib.API_窗口.窗口_取顶级父窗口(clng(ar(i)))
TracePrint hwnd
If hwnd = 窗口句柄 Then
判断句柄2=clng(ar(i))
Exit For
End If
Next
End Function
复制代码

本主题由 管理员 青黛 于 2018/2/26 16:04:42 执行 审核主题 操作
发新话题 回复该主题