Tutorial C++ Sending KeyStrokes

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat


Dank Tier Donator
Nov 12, 2014
Saw some Requests, didnt saw a proper Thread about it.

To send a KeyStroke in C++ is really simple:

keybd_event(0x56, 0, 0, 0); //Press down the Key
keybd_event(0x56, 0, KEYEVENTF_KEYUP, 0); //Release the Key
If u are interested in the Syntax and the Parameters here is the Link to the MSDN Site

The 0x56 in this example represence the "V" Key and is a Virtual-Key Code. And Again I refere to the official MSDN Site. Virtual-Key Codes

This is very Basic stuff, but still I would use this in a Function, so u declare all Keys u need at 1 Point and u can easy ge to it at another Point

void A()
keybd_event(0x41, 0, 0, 0); 
keybd_event(0x41, 0, KEYEVENTF_KEYUP, 0);
void B()
keybd_event(0x42, 0, 0, 0); 
keybd_event(0x42, 0, KEYEVENTF_KEYUP, 0);
void C()
keybd_event(0x43, 0, 0, 0); 
keybd_event(0x43, 0, KEYEVENTF_KEYUP, 0);

If u want to send this Keys to an Process u can easily focus it:

HWND GameWindow = FindWindow(0, "Game");
That's it very simple. I do not credits anything of this because its all basic stuff from MSDN. Sorry for some mistakes Im bored and wrote this with a Phone..

Also I never needed more than some simple Keys but If u prefer sending Full sentences Read this: https://www.codeproject.com/Articles/6819/SendKeys-in-C
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