Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Write a string from a TextBox to game memory(Help)

WuzzWuzz Member Posts: 2
Private Sub Timer4_Timer()
' Declare some variables we need
Dim hwnd As Long ' Holds the handle returned by FindWindow
Dim pid As Long ' Used to hold the Process Id
Dim pHandle As Long ' Holds the Process Handle
Dim str As String * 20 ' String to hold display text
str = txtHstn2.Text
' First get a handle to the "game" window
hwnd = FindWindow(vbNullString,"Clock Time")
If (hwnd = 0) Then Exit Sub

' We can now get the pid
GetWindowThreadProcessId hwnd, pid

' Use the pid to get a Process Handle
pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If (pHandle = 0) Then
MsgBox "Couldn't get a process handle!"
Exit Sub
End If

' Now we can write to our address in memory

WriteProcessMemory pHandle, &H83073C, str, 20, 0&

' Close the Process Handle
CloseHandle hProcess
End Sub

This is the code I am trying to use. I would like the txtHstn2.Text to change a players name in the game. The timer is set for 10000 to hold the text.
Any help would be nice. I can get the ReadProcessMemory pHandle to work but not the Write.
Sign In or Register to comment.