Public Class Form1
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim name As String = "zuma"
Dim hProcess As Process() = Process.GetProcessesByName(name)
Dim address As Integer = &H35480C0
Dim currentscore As Integer
ReadProcessMemory(hProcess(0).Handle, address, currentscore, 4, 0)
Label1.Text = currentscore
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim name As String = "zuma"
Dim hProcess As Process() = Process.GetProcessesByName(name)
Dim address As Integer = &H35480C0
Dim value As Integer = 10009999
WriteProcessMemory(hProcess(0).Handle, address, value, 4, 0)
End Sub
End Class
ลองเปลี่ยนจาก Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer
Private Declare Function ReadProcessMemory Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Integer, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) เป็น
Private Declare Function ReadProcessMemory Lib "kernel32" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Long, ByVal nSize As Integer, ByRef BytesWritten As Integer) As Integer
Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal Handle As Integer, ByVal Address As Integer, ByRef Value As Long, ByVal nSize As Integer, ByRef BytesWritten As Integer) As Integer