hola yo tengo un codigo que lo hice en vb 6, me gustaria pasarlo a visual .net estuve intentando pero no me funciona
este es el codigo
en un modulo
y despues en el formulario
gracias desde ya
este es el codigo
en un modulo
Código [Seleccionar]
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
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
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
Declare Function GetCurrentProcess Lib "kernel32" () As Long
Global Const SYNCHRONIZE As Long = &H100000
Global Const STANDARD_RIGHTS_REQUIRED As Long = &HF0000
Global Const PROCESS_ALL_ACCESS As Long = (STANDARD_RIGHTS_REQUIRED Or SYNCHRONIZE Or &HFFF)
Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal nVirtKey As Long) As Integer
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public WindowHandle As Long
Public ProcessID As Long
Public ProcessHandle As Long
Public Function GetGTAProcess(fProcessName As String) As Boolean
WindowHandle = FindWindow(vbNullString, fProcessName)
If (WindowHandle = 0) Then
GetGTAProcess = False
Exit Function
End If
GetWindowThreadProcessId WindowHandle, ProcessID
ProcessHandle = OpenProcess(PROCESS_ALL_ACCESS, False, ProcessID)
If (ProcessHandle = 0) Then
GetGTAProcess = False
Exit Function
End If
GetGTAProcess = True
End Function
Public Function SAptrPlayer() As Long
SAptrPlayer = ReadLong(&HB6F5F0)
End Function
Public Function ReadDMASingle(Address As Long, Offset As Long) As Single
ReadProcessMemory ProcessHandle, Address + Offset, ReadDMASingle, 4&, 0&
End Function
Public Function ReadLong(Address As Long) As Long
ReadProcessMemory ProcessHandle, Address, ReadLong, 4&, 0&
End Function
y despues en el formulario
Código [Seleccionar]
Private Sub Timer1_Timer()
Text1.Text = ReadDMASingle(SAptrPlayer, &H540&)
End Sub
Private Sub Timer3_Timer()
GetGTAProcess ("GTA:SA:MP")
End Sub
gracias desde ya