What is wrong with my code?
I'm trying to learn so please don't tell me any other mistakes i made in my code because i want to find them by myself.
I have this code:
Code:
#include <iostream>
#include <Windows.h>
using namespace std;
DWORD Ammo = 0x31FC;
int MyAmmo;
int main{
HWND hwnd = FindWindowA(NULL, "Counter-Strike: Global Offensive");
if (hwnd == NULL) {
cout << "Process not found" << endl;
sleep(4000);
exit(-1);
}
else {
DWORD ProcId;
GetWindowThreadProcessId(hwnd, &procId);
HANDLE handle = OpenProcess(PROCESS_VM_READ, FALSE, ProcId);
if (procId == NULL) {
cout << "process not obtained" << endl;
sleep(4000);
exit(-1);
}
else {
while (true) {
ReadProcessMemory(handle, (LPVOID)Ammo, &MyAmmo, sizeof(MyAmmo), NULL);
cout << MyAmmo;
Sleep(100);
}
}
}
}
I'm trying to compile it but i get this error at line 9:
Error C2275 'HWND': illegal use of this type as an expression
Please help me.