PostHelpWhat is wrong with my code?

Posts 1–3 of 3 · Page 1 of 1
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.
Help please?

- - - Updated - - -

yeah i realised that i forgot the brackets at int main
Quote Originally Posted by spotplay View Post
Help please?

- - - Updated - - -

yeah i realised that i forgot the brackets at int main
i was just going to say that...
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us