红色警戒2尤里的复仇(单人游戏加钱)修改器
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
没有事玩起了老游戏“红色警戒2尤里的复仇”
但是钱的问题让我没有办法!于是做了一个简单程序,修改一下钱,哈哈!下面就是代码了,也很简单!看下就知道了
Option Explicit
'寻找窗口列表中第一个符合指定条件的顶级窗口(在vb里使用:FindWindow最常见的一个用途是获得ThunderRTMain类的隐藏窗口的句柄;该类是所有运行中vb执行程序的一部分。获得句柄后,可用api函数GetWindowText取得这个窗口的名称;该名也是应用程序的标题)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
'得到窗体控件句柄的函数
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 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 Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
'读取进程内存的函数
Private Declare Function ReadProcessMemory Lib "kernel32.dll" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByRef lpBuffer As Any, ByVal nSize As Long, ByRef lpNumberOfBytesWritten 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 Fr As Boolean
Private Const STANDARD_RIGHTS_REQUIRED = &HF0000
Private Const SYNCHRONIZE = &H100000
Private Const PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF)
Private 打开进程As Boolean
Private hwd As Long
Private pid As Long
Private sb As Long, pb As Long, B As Long, s As Long
Private hProcess As Long '存放进程句柄
Private Sub Command1_Click()
If 打开进程Then
On Error GoTo E
s = s + Val(Text1.Text)
WriteProcessMemory hProcess, ByVal (B + pb), s, 4, 0&
ReadProcessMemory hProcess, ByVal B + pb, s, 4, 0&
Label1.Caption = GetStrMony(s)
End If
Exit Sub
E:
On Error GoTo 0
CloseHandle hProcess
打开进程= False
End Sub
Private Sub Form_Load()
sb = CLng("&H" & Text2.Text)
pb = CLng("&H" & Text3.Text)
Label3_Click
End Sub
Private Sub Form_Unload(Cancel As Integer)
CloseHandle hProcess
End Sub
Private Sub Label3_Click()
If Fr Then Me.Height = 3120 Else Me.Height = 1755
Fr = Not Fr
End Sub
Private Sub Text2_Change()
sb = CLng("&H" & Text2.Text): 打开进程= False
End Sub
Private Sub Text3_Change()
pb = CLng("&H" & Text3.Text): 打开进程= False
End Sub
Private Sub Text4_Change()
打开进程= False
CloseHandle hProcess
End Sub
Private Sub Timer1_Timer()
If 打开进程= False Then
hwd = FindWindow(vbNullString, Text4.Text)
If hwd <> 0 Then
GetWindowThreadProcessId hwd, pid