This pathetic ReadAByte problem >.<
Hi, I'm trying to get value as a byte from address with:
My function:
I get always value "0" with ReadAByte (ReadALong works thought, but I need byte for this) so there is error somewhere but I can't locate it? Or is there any calculation that I can change 4 byte value to a normal byte?
Code:
Dim u As Byte
Call ReadAByte("MyProgram", &H100534E, u)
Code:
Public Function ReadAByte(TheGame As String, TheAddress As Long, ThisIsTheValue As Byte)
Dim SomeValueIsStoredHere As Long
Dim SomeValueIsStoredHereToo As Long
Dim SomeValue As Long
SomeValueIsStoredHere = FindWindow(vbNullString, TheGame)
GetWindowThreadProcessId SomeValueIsStoredHere, SomeValueIsStoredHereToo
SomeValue = OpenProcess(PROCESS_ALL_ACCESS, False, SomeValueIsStoredHereToo)
If (SomeValue = 0) Then
Exit Function
End If
ReadProcessMem SomeValue, TheAddress, thevalue, 1, 0&
CloseHandle hProcess
End Function


