怎么用VB做一个 连连看挂
4个回答
2013-07-01
展开全部
编程遍了一个晚上,终于编出来了,代码给你发过去,如下:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesRead As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const PROCESS_VM_OPERATION = &H8&
Private Const PROCESS_VM_READ = &H10&
Private Const PROCESS_VM_WRITE = &H20&
Private Sub Timer1_Timer()
Dim hwnd As Long
hwnd = FindWindow(vbNullString, "连连看")
If hwnd = 0 Then
Label1.Caption = "游戏未加载"
Timer2.Enabled = False
Check1.Enabled = False
Check2.Enabled = False
Check3.Enabled = False
Exit Sub
End If
Label1.Caption = "游戏已加载"
Timer2.Enabled = True
Check1.Enabled = True
Check2.Enabled = True
Check3.Enabled = True
End Sub
Private Sub Timer2_Timer()
Dim hwnd As Long
Dim PId As Long
Dim pHandle As Long
hwnd = FindWindow(vbNullString, "连连看")
GetWindowThreadProcessId hwnd, PId
pHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, 0, PId)
If pHandle = 0 Then
MsgBox "打开程序错误"
Exit Sub
End If
If Check1.Value = Checked Then WriteProcessMemory pHandle, &H12FEB8, 100, 1, 0& '生命
If Check2.Value = Checked Then WriteProcessMemory pHandle, &H12FEBC, 100, 1, 0& '提示
If Check3.Value = Checked Then WriteProcessMemory pHandle, &H12F4D4, 100, 1, 0& '时间
CloseHandle pHandle
End Sub
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesRead As Long) As Long
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const PROCESS_VM_OPERATION = &H8&
Private Const PROCESS_VM_READ = &H10&
Private Const PROCESS_VM_WRITE = &H20&
Private Sub Timer1_Timer()
Dim hwnd As Long
hwnd = FindWindow(vbNullString, "连连看")
If hwnd = 0 Then
Label1.Caption = "游戏未加载"
Timer2.Enabled = False
Check1.Enabled = False
Check2.Enabled = False
Check3.Enabled = False
Exit Sub
End If
Label1.Caption = "游戏已加载"
Timer2.Enabled = True
Check1.Enabled = True
Check2.Enabled = True
Check3.Enabled = True
End Sub
Private Sub Timer2_Timer()
Dim hwnd As Long
Dim PId As Long
Dim pHandle As Long
hwnd = FindWindow(vbNullString, "连连看")
GetWindowThreadProcessId hwnd, PId
pHandle = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, 0, PId)
If pHandle = 0 Then
MsgBox "打开程序错误"
Exit Sub
End If
If Check1.Value = Checked Then WriteProcessMemory pHandle, &H12FEB8, 100, 1, 0& '生命
If Check2.Value = Checked Then WriteProcessMemory pHandle, &H12FEBC, 100, 1, 0& '提示
If Check3.Value = Checked Then WriteProcessMemory pHandle, &H12F4D4, 100, 1, 0& '时间
CloseHandle pHandle
End Sub
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
2013-07-01
展开全部
截取画面,用坐标系分解该画面并识别到一个二维数组,经过简单匹配后用API控制鼠标点击游戏里对应图像。
要是没有几年VB经验还是有一点难度的。
要是没有几年VB经验还是有一点难度的。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-07-01
展开全部
一个动画教程 VB写连连看外挂的 http://www.hack59.com/donghua/biancheng/506.html
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-07-01
展开全部
这个不好做 你可以自己动手下一个啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询