User_BELGIUM
Legacy Member
Een vriend van me zijt met een 'klein' probleempje. Z'n code veroorzaakt fouten. Mssn zien jullie een oplossing van het 'bugt'
Hello, I'm creating this program who should read a memory value from a game and put this in a textbox. But for some reason the FindWindow always returns false.
Here's the code. Pls help out.
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName 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 ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Sub cmdGetInfo_Click()
' 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 intExp As String
' First get a handle to the "game" window
hwnd = FindWindow(vbNullString, "Tibia")
If (hwnd = 0) Then
MsgBox "Window not found!"
Exit Sub
End If
' 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
ReadProcessMemory pHandle, &H4903C, intExp, 5, 0&
txtOwnExp.Text = intExp
' Close the Process Handle
CloseHandle hProcess
End Sub
Hello, I'm creating this program who should read a memory value from a game and put this in a textbox. But for some reason the FindWindow always returns false.
Here's the code. Pls help out.
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName 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 ReadProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByVal lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Sub cmdGetInfo_Click()
' 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 intExp As String
' First get a handle to the "game" window
hwnd = FindWindow(vbNullString, "Tibia")
If (hwnd = 0) Then
MsgBox "Window not found!"
Exit Sub
End If
' 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
ReadProcessMemory pHandle, &H4903C, intExp, 5, 0&
txtOwnExp.Text = intExp
' Close the Process Handle
CloseHandle hProcess
End Sub
kijk best eens met een window spy prog om de juiste aantal spaties te hebbe. Want ze zouden dit eens kunnen veranderen met nieuwe patch.