- 闲来无聊,下了个连连看不过难度太高 玩不过于是花了点时间弄了个挂出来
- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
- Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId 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 Const PROCESS_ALL_ACCESS = &H1F0FFF
- Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal HProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
- Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
- Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal HProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
- Private Sub Command1_Click()
- Dim hwnd As Long, Pid As Long, HProcess As Long
- Dim Zhi As Long, Dizhi As Long, Pianyi As Long
- hwnd = FindWindow(vbNullString, "连连看 v4.7")
- '判断FindWindow返回的值是否为0
- GetWindowThreadProcessId hwnd, Pid
- ' 取得进程标识符
- HProcess = OpenProcess(PROCESS_ALL_ACCESS, False, Pid) '以最好权限打开进程
- Zhi = 1244860 '这里是基地址,本来是十六进制,但是我们要把他转换成十进制的
- Pianyi = 2748
- Call ReadProcessMemory(HProcess, ByVal Zhi, Dizhi, 4, 0&)
- Call ReadProcessMemory(HProcess, ByVal Dizhi + Pianyi, Dizhi, 4, 0&) '这里的52是偏移量34的十进制,本来也是十六进制的,但是已经转好了
- WriteProcessMemory HProcess, ByVal &H12FEBC, 9999, 4, 0&
- Call CloseHandle(HProcess)
- End Sub
- Private Sub Command2_Click()
- Dim hwnd As Long, Pid As Long, HProcess As Long
- Dim Zhi As Long, Dizhi As Long, Pianyi As Long
- hwnd = FindWindow(vbNullString, "连连看 v4.7")
- '判断FindWindow返回的值是否为0
- GetWindowThreadProcessId hwnd, Pid
- ' 取得进程标识符
- HProcess = OpenProcess(PROCESS_ALL_ACCESS, False, Pid) '以最好权限打开进程
- Zhi = 1244860 '这里是基地址,本来是十六进制,但是我们要把他转换成十进制的
- Pianyi = 2748
- Call ReadProcessMemory(HProcess, ByVal Zhi, Dizhi, 4, 0&)
- Call ReadProcessMemory(HProcess, ByVal Dizhi + Pianyi, Dizhi, 4, 0&) '这里的52是偏移量34的十进制,本来也是十六进制的,但是已经转好了
- WriteProcessMemory HProcess, ByVal &H12FEB8, 9999, 4, 0&
- Call CloseHandle(HProcess)
- End Sub
- Private Sub Form_Load()
- Dim hwnd As Long
- hwnd = FindWindow(vbNullString, "连连看 v4.7")
- If (hwnd = 0) Then '判断FindWindow返回的值是否为0
- MsgBox "连连看V4.7没有运行,请运行后再使用本程序!", vbOKOnly, "友情提示"
- Unload Me
- End If
- End Sub
- Private Sub Timer1_Timer()
- Dim hwnd As Long, Pid As Long, HProcess As Long
- Dim Zhi As Long, Dizhi As Long, Pianyi As Long
- hwnd = FindWindow(vbNullString, "连连看 v4.7")
- '判断FindWindow返回的值是否为0
- GetWindowThreadProcessId hwnd, Pid
- ' 取得进程标识符
- HProcess = OpenProcess(PROCESS_ALL_ACCESS, False, Pid) '以最好权限打开进程
- Zhi = 1244860 '这里是基地址,本来是十六进制,但是我们要把他转换成十进制的
- Pianyi = 2748
- Call ReadProcessMemory(HProcess, ByVal Zhi, Dizhi, 4, 0&)
- Call ReadProcessMemory(HProcess, ByVal Dizhi + Pianyi, Dizhi, 4, 0&) '这里的52是偏移量34的十进制,本来也是十六进制的,但是已经转好了
- Label1.Caption = "当前提示次数:" & Dizhi '这里是血的地址,血地址=基地址+偏移量34
- End Sub
- Private Sub Timer2_Timer()
- Dim hwnd As Long, Pid As Long, HProcess As Long
- Dim Zhi As Long, Dizhi As Long, Pianyi As Long
- hwnd = FindWindow(vbNullString, "连连看 v4.7")
- '判断FindWindow返回的值是否为0
- GetWindowThreadProcessId hwnd, Pid
- ' 取得进程标识符
- HProcess = OpenProcess(PROCESS_ALL_ACCESS, False, Pid) '以最好权限打开进程
- Zhi = 1244856 '这里是基地址,本来是十六进制,但是我们要把他转换成十进制的
- Pianyi = 2752
- Call ReadProcessMemory(HProcess, ByVal Zhi, Dizhi, 4, 0&)
- Call ReadProcessMemory(HProcess, ByVal Dizhi + Pianyi, Dizhi, 4, 0&) '这里的52是偏移量34的十进制,本来也是十六进制的,但是已经转好了
- Label2.Caption = "当前洗牌次数:" & Dizhi '这里是血的地址,血地址=基地址+偏移量34
- End Sub
复制代码 |