1个回答
2013-12-07
展开全部
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 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
研信通
2024-11-28 广告
2024-11-28 广告
北京研信通科技公司是集研发、生产、销售、服务于一体的高新技术企业,自成立以来,一直致力于动作捕捉系统的研发、生产和销售,其产品广泛应用于影视动画、游戏开发、虚拟现实、机器人研发、康复医疗等领域,可满足不同行业客户的需求。研信通科技公司经过多...
点击进入详情页
本回答由研信通提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询