if (ReadProcessMemory(hProcess, (unsigned __int64 *)SquadPointsAddr, &SquadPointsDec, sizeof(SquadPointsAddr), NULL))
ReadProcessMemory(handle, source_addr, dest_addr,
size_of_dest, bytes_read)
size_of_dest = sizeof(SquadPointsDec), not sizeOf(SquadPointsAddr) -- but in this example they're both 64 bits.
Is squad points actually stored as Int64, or something smaller?
Also, GetProcessId()
GetProcessId function (Windows)
It expects a process HANDLE, not a window HANDLE. Probably a different windows function for you to use...
guick google:
https://www.google.com/search?q=GetP...+window+handle
result:
Get process id from window handle
GetWindowThreadProcessId(hwnd, out processId);
edit: looks like you call the correct one right after

..I think the first call to GetProcessId() is pointless, but the next line should set it correctly. ?
ProcessId = GetProcessId(hwnd);
GetWindowThreadProcessId(hwnd, &ProcessId);
Which part is giving you trouble? What works / doesn't work?
1. is the window found?
2. is the process ID found?
3. does OpenProcess() return a valid handle?
I re-structured the code a little bit (the IF statements). Your way kind-of worked, but for example you use 'hwnd'
before making sure it's valid. I changed the cout's because it's helpful to know which functions/values you're getting messages for.
codefromimage
#include <Windows.h>
#include <iostream>
using namespace std;
int main()
{
HWND hwnd; //window handle returned by FindWindow()
DWORD ProcessId; //processID returned by GetWindowThreadProcessId()
HANDLE hProcess; //handle returned from OpenProcess()
hwnd = FindWindow(0, "Calculator");
if (hwnd){
cout << "WINDOW FOUND: " << hwnd << endl;
GetWindowThreadProcessId(hwnd, &ProcessId);
cout << "ProcessId: " << ProcessId << endl;
HANDLE hProcess = OpenProcess(PROCESS_VM_READ, FALSE, ProcessId);
if (hProcess)
{
cout << "OpenProcess() Success : Handle returned: " << hProcess << endl;
/*Do Reading and whatnot here...*/
CloseHandle(hProcess);
}
else
{
cout <<"OpenProcess() FAILED : Handle returned: " << hProcess << endl;
}
}
else {
cout << "WINDOW NOT FOUND." << endl << "Window Handle (invalid): " << hwnd << endl;
}
cout << "\n\nLeaving program...\n\n" << endl;
system("pause");
return 0;
}
Once this part is working 100%, move on to calling ReadProcessMemory().