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, ByRef 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 Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Form_load()
Me.Caption = ReadMemory(&H6059CC)
End Sub
Private Function tHvnd() As Long
tHvnd = FindWindow("tibiaclient", vbNullString)
End Function
Private Function ReadMemory(Address As Long) As Long
Dim ProcessID As Long, processHandle As Long
If tHvnd = 0 Then Exit Function
GetWindowThreadProcessId tHvnd, ProcessID
processHandle = OpenProcess(&H10, False, ProcessID)
If processHandle = 0 Then Exit Function
ReadProcessMemory processHandle, Address, ReadMemory, 4, 0&
CloseHandle processHandle
End Function