Private Sub start_Click()
Dim hwnd As Long ' 储存 FindWindow 函数返回的句柄
Dim pid As Long ' 储存进程标识符( Process Id )
hwnd = FindWindow(vbNullString, "DX-Ball 2 (Press P to pause, and Alt-Tab to switch apps)")
If (hwnd = 0) Then
MsgBox "找不到游戏进程!", vbOKOnly, "出错!"
Exit Sub
End If
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
Else: btnPasteName.Caption = "修改开始!": Command1.Enabled = True: Command2.Enabled = True
End If
EnableDebugPriv
End Sub
Private Sub Command1_Click()
sd = (sd + 1) Mod 2 '开关自动锁定
If sd = 1 Then
ReadTimer.Enabled = True: Command1.Caption = "已经自动锁定"
Else
ReadTimer.Enabled = False: Command1.Caption = "已经取消锁定"
End If
End Sub
Private Sub Command2_Click()
Call ReadTimer_Timer
End Sub
Private Sub Form_Load()
combot = 1
sd = 0
End Sub
Private Sub Form_Unload(Cancel As Integer)
CloseHandle pHandle
End Sub
Private Sub ReadTimer_Timer() '修改代码
If CD0.Value = True Then combot = 0
If CD1.Value = True Then combot = 1
If CD2.Value = True Then combot = 2
If CD3.Value = True Then combot = 3
If CD4.Value = True Then combot = 4
WriteProcessMemory pHandle, &H4FCBD0, combot, 1, ByVal 0& '长度
WriteProcessMemory pHandle, &H52C660, ZD.Value, 1, ByVal 0& '子弹
WriteProcessMemory pHandle, &H5284B8, HQ.Value, 1, ByVal 0& '火球
WriteProcessMemory pHandle, &H52AEE0, CT.Value, 1, ByVal 0& '穿透
WriteProcessMemory pHandle, &H5284B4, XY.Value, 1, ByVal 0& '吸引
End Sub
Dim hang, lie, index2 As Long
Private Sub Command1_Click()
Dim hwnd As Long ' 储存 FindWindow 函数返回的句柄
Dim pid As Long ' 储存进程标识符( Process Id )
hwnd = FindWindow(vbNullString, "监狱(Quod)")
If (hwnd = 0) Then
MsgBox "找不到游戏进程!", vbOKOnly, "出错!"
Exit Sub
End If
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
Else: Command1.Caption = "修改开始!"
End If
EnableDebugPriv
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Byte, j As Byte
Dim readad As Long, readad2 As Long
If (pHandle = 0) Then
MsgBox "找不到游戏进程!", vbOKOnly, "出错!"
Exit Sub
End If
For i = 0 To 120
readad = &H971FA0 + i
ReadProcessMemory pHandle, readad, j, 2, ByVal 0&
Select Case j
Case 0
readad = &H8000000F '根据内存数据改变棋子颜色
Case 1
readad = &HFF&
Case 2
readad = &HFF0000
Case 3
readad = &HFFFFFF
End Select
Shape1(i).FillColor = readad
Next i
Select Case X '这两个case判断鼠标点击的是哪一个棋子
Case 120 To 615
lie = 1
Case 720 To 1215
lie = 2
Case 1320 To 1815
lie = 3
Case 1920 To 2415
lie = 4
Case 2520 To 3015
lie = 5
Case 3120 To 3615
lie = 6
Case 3720 To 4215
lie = 7
Case 4320 To 4815
lie = 8
Case 4920 To 5415
lie = 9
Case 5520 To 6015
lie = 10
Case 6120 To 6615
lie = 11
Case Else
lie = 0
End Select
Select Case Y
Case 120 To 615
hang = 1
Case 720 To 1215
hang = 2
Case 1320 To 1815
hang = 3
Case 1920 To 2415
hang = 4
Case 2520 To 3015
hang = 5
Case 3120 To 3615
hang = 6
Case 3720 To 4215
hang = 7
Case 4320 To 4815
hang = 8
Case 4920 To 5415
hang = 9
Case 5520 To 6015
hang = 10
Case 6120 To 6615
hang = 11
Case Else
hang = 0
End Select
If (lie <> 0 And hang <> 0) Then '点击后改变棋子颜色并写入游戏内存
index2 = ((lie - 1) * 11 + hang - 1)
readad2 = &H971FA0 + index2
If Shape1(index2).FillColor = &H8000000F Then
Shape1(index2).FillColor = &HFF&: WriteProcessMemory pHandle, readad2, 1, 1, ByVal 0&
ElseIf Shape1(index2).FillColor = &HFF& Then
Shape1(index2).FillColor = &HFF0000: WriteProcessMemory pHandle, readad2, 2, 1, ByVal 0&
ElseIf Shape1(index2).FillColor = &HFF0000 Then
Shape1(index2).FillColor = &HFFFFFF: WriteProcessMemory pHandle, readad2, 3, 1, ByVal 0&
ElseIf Shape1(index2).FillColor = &HFFFFFF Then
Shape1(index2).FillColor = &H8000000F: WriteProcessMemory pHandle, readad2, 0, 1, ByVal 0&
End If
End If
End Sub
VB声明
Declare Function Ellipse Lib "gdi32" Alias "Ellipse" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
说明
描绘一个椭圆,由指定的矩形围绕。椭圆用当前选择的画笔描绘,并用当前选择的刷子填充
返回值
Long,非零表示成功,零表示失败。会设置GetLastError
参数表
参数 类型及说明
hdc Long,设备场景的句柄
X1,Y1 Long,约束矩形采用逻辑坐标的左上角位置
X2,Y2 Long,约束矩形采用逻辑坐标的右下角位置