Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Write a string from a TextBox to game memory(Help)
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!"
' Now we can write to our address in memory
WriteProcessMemory pHandle, &H83073C, str, 20, 0&
' Close the Process Handle
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.
0 · ·