Private Const PROCESS_ALL_ACCESS = &H1F0FFF
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal SomeValueIsStoredHere 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 CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
Private Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
Private Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Public Function ReadALong(Title As String, TheAddress As Long, TheValue As Long, bts As Long)
Dim WHwnd As Long
Dim GWTPI As Long
Dim SomeValue As Long
WHwnd = FindWindow(vbNullString, Title)
GetWindowThreadProcessId WHwnd, GWTPI
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, GWTPI)
If (SomeValue = 0) Then
Exit Function
End If
ReadProcessMem SomeValue, TheAddress, TheValue, bts, 0&
Text1 = TheValue
CloseHandle hProcess
End Function
Private Sub Command1_Click()
Call ReadALong("*Sin título: Bloc de notas", Val(1769725278928#), vbNull, 1)
End Sub