初学者关于用API修改游戏的提问
小弟最近想用VB的API功能作一个<合金成弹头X>的修改器,但是自己编的程序一能正确的修改游戏,请大家指正一下.
<合金成弹头X>是在NeoRAGEx外壳下运行的.手雷数的地址为&H56ADFD.
程序如下:
Dim gamehwnd As Long
Dim pid As Long
Dim hprocess As Long
Option Explicit
Private Sub Check1_Click()
If Check1.Value = 1 Then
Timer1.Enabled = True
Else
Timer1.Enabled = False
End If
End Sub
Private Sub Form_Load()
gamehwnd = FindWindow("NeoRAGEx", vbNullString)
Debug.Print gamehwnd
If gamehwnd = 0 Then
MsgBox "请先运行NeoRAGEx", vbOKOnly, "注意"
End If
End Sub
Private Sub Timer1_Timer()
Dim gamehapaddress As Long
Dim gamehpvalue As Byte
GetWindowThreadProcessId gamehwnd, pid
hprocess = OpenProcess(0, False, pid)
gamehapaddress = &H56ADFD
gamehpvalue = &HC
WriteProcessMemory hprocess, gamehapaddress, gamehpvalue, 1, 0&
CloseHandle hprocess
End Sub