Source Code Win 32 window base (c++)

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

dmo

Coder
Full Member
Nobleman
Nov 8, 2014
145
678
5
A simple Win32 / c++ base to do your cheats.

C++:
#include <Windows.h>
#include <iostream>

#define ID_TIMER 1

class Window{

public:
	WNDCLASSEX wcx;
	HWND hwnd, gameHwnd;
	MSG msg;
	bool gameFound = false;

	bool RegClassEx(HINSTANCE hInst); //wndclassex
	bool CreateMyWindow(HINSTANCE hInst); //registerclassex
	int MyMsg(); //process window msgs - this run the program

}; Window MyWnd;

LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); //process all window msgs	

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(szCmdLine);
	UNREFERENCED_PARAMETER(iCmdShow);

	if(!MyWnd.RegClassEx(hInstance)) return 1;
	if(!MyWnd.CreateMyWindow(hInstance)) return 1;	
	ShowWindow(MyWnd.hwnd, SW_SHOW);
	UpdateWindow(MyWnd.hwnd);
	
	return MyWnd.MyMsg();
}


bool Window::RegClassEx(HINSTANCE hInst){
	ZeroMemory(&wcx, sizeof(WNDCLASSEX));
	MyWnd.wcx.cbSize = sizeof(WNDCLASSEX);
	MyWnd.wcx.style = CS_HREDRAW | CS_VREDRAW;
	MyWnd.wcx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
	MyWnd.wcx.hCursor = LoadCursor(NULL, IDC_ARROW);
	MyWnd.wcx.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	MyWnd.wcx.lpszClassName = "main";
	MyWnd.wcx.lpszMenuName = NULL;
	MyWnd.wcx.hInstance = hInst;
	MyWnd.wcx.lpfnWndProc = WndProc;

	if (!RegisterClassEx(&wcx)){ MessageBox(NULL, "RegisterClassEx", "RegisterClassEx", MB_OK | MB_ICONERROR); return false; }	
	return true;
}

bool Window::CreateMyWindow(HINSTANCE hInst){
	const int x = GetSystemMetrics(SM_CXSCREEN) / 2 - 150;
	const int y = GetSystemMetrics(SM_CYSCREEN) / 2 - 150;

	MyWnd.hwnd = CreateWindowEx(
		WS_EX_OVERLAPPEDWINDOW,
		"main",
		"Hu3 hu3 hu3 br br br",
		WS_OVERLAPPEDWINDOW,
		x, y, 300, 100,
		NULL, NULL, hInst, NULL);
	if (MyWnd.hwnd == NULL) { MessageBox(NULL, "CreateWindowEx", "CreateWindowEx", MB_OK | MB_ICONERROR); return false; }
	return true;
}

int Window::MyMsg(){
	while (msg.message != WM_QUIT){
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)){
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else{
			if (gameFound){
				//do your stuff here
			}
						
		}
	}
	return (int)msg.wParam;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
	switch (uMsg){

	case WM_CREATE:{
		if (!SetTimer(hwnd, ID_TIMER, 1000, NULL)){ MessageBox(hwnd, "SetTimer", "Could not SetTimer. Exiting!", 0); CloseWindow(MyWnd.hwnd); }
	}break;

	case WM_CLOSE:{
		KillTimer(MyWnd.hwnd, ID_TIMER);
		DestroyWindow(MyWnd.hwnd);
	}break;

	case WM_DESTROY:{
		PostQuitMessage(0);
	}break;


	case WM_TIMER:{		
		if (MyWnd.gameHwnd != NULL){
			MyWnd.gameFound = true;						
		}
		else{
			MyWnd.gameFound = false;
			MyWnd.gameHwnd = FindWindow(NULL, "Quake Live");
		}	
	}break;


	default: return DefWindowProc(hwnd, uMsg, wParam, lParam);
	}
	return 0;
}
Set your project to multi-byte in VS.

Pros to use Win32:
-Small app
-Easy to code
-Compile faster
-it's funny to learn.

Cons:
-need to hard code everything.

:eek:
 
Last edited:

dmo

Coder
Full Member
Nobleman
Nov 8, 2014
145
678
5
LoL it's ridiculous! I took one look at it a few months ago and said "Hell no"
You had more balls than I did!
I found lots of good information here:
https://www.winprog.org/tutorial/simple_window.html
I only started to use it, because my Visual Studio was with problem to create forms than i start coding everything like this, and i can say that after learn, you gonna love it. Everything will be more easy to code.

It's easy to code, the problem is to know the api. I almost can get any api in msdn now and start to code with it.
 
Last edited:
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods