Could you post the VM_READ, VM_WRITE constants mr. STN?
I couldn't find them in VB6 Api Text Viewer.
For the + sign, you mean it would be like:
processHandle=OpenProcess(+, false, procId)
Also another small questions about VB6. They are:
1. How to find the Window Caption from process name??
Like I have a "notepad.exe", and want to retrieve the Window Caption just from the "notepad.exe" process. Without having the process on top (foreground). The reason I want this module is because I have created a Bot for Perfect World in VB6, but then I meet this problem. When I minimized the program into the System Tray, my program cannot find the window since it doesn't listed in Windows's Window Lists anymore. I figured that to solve this problem is by hooking into the right process, since Perfect World can be played in multiple client, it will have two or more Window Captions. Lets take it that I have renamed the first window caption into "My Element Client". So I could get the handle by filtering it like: GetProcess("elementclient.exe") Where ProcessCaption="My Element Client".
2. How to read a byte, 2 byte, and 4 byte values with ReadProcessMemory? As my program always return a wrong value if I change the byte into 1 or 2. Here's the module:
Public Function readIt(address As Long, value As Long, byteLength As Byte)
Dim hWnd As Long, procId As Long, processHandle As Long
hWnd = FindWindow(vbNullString, gameName)
If (hWnd = 0) Then
MsgBox "Cannot find the game", vbCritical, "Error occured"
GetWindowThreadProcessId hWnd, procId
processHandle = OpenProcess(PROCESS_ALL_ACCESS, False, procId)
If (processHandle = 0) Then
MsgBox "Cannot handle the game", vbCritical, "Error occured"
ReadProcessMemory processHandle, address, value, byteLength, 0&