Tutorial C++ Sending KeyStrokes

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

Brutalon

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

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

C++:
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 use them at another Point

C++:
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);
}

for(...)
{
A();
B();
C();
If u want to send this Keys to an Process u can easily focus it:

C++:
HWND GameWindow = FindWindow(0, "Game");
SetForegroundWindow(GameWindow);
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
 
Last edited:

Heisa

Jr.Coder
Full Member
Nobleman
Jul 3, 2013
77
703
3
What about sending keys to a game, that has anticheat that prevents it and blocks it? How is that done?
 

Liduen

Hacker
Dank Tier VIP
May 19, 2013
702
8,478
33
What about sending keys to a game, that has anticheat that prevents it and blocks it? How is that done?
Why on earth should an anticheat system prevent you to send keystrokes to a window?
 

Brutalon

Newbie
Dank Tier Donator
Nov 12, 2014
13
338
0
Some games do this they block some Methods from external resources but I dont think they actually do this with simple key events.
 

gatero

Newbie
Full Member
Jul 10, 2014
13
142
0
Why on earth should an anticheat system prevent you to send keystrokes to a window?
I play a really basic 2D game called ImperiumAO from my country Argentina but it is really fun because lots of friends play it and pvp is really fun. But i cant cheat this game because a really
important thing of this game is helth recovery potions and i use them pressing F1 or F2 ... . I tried making a cheat with sendkeys on Vb or KeyStroke in C++ and the game blocks them i mean
the dont take the potions idk why. I tried diferent ways and nothing. If you can help me with this it would be awsome. I know a good way would be sending packages but idk how. If you help
me i would be really happy i have been looking for a way for a lot of time.
Here is a video of the game.
https://www.youtube.com/watch?v=pqFP_R0XbIw
 
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