Need help sending keystrokes to game window!

Status
Not open for further replies.

Plaii

Newbie
Joined
Mar 28, 2015
Messages
5
Reaction score
0
Points
11
Swag Level :
3982
Alright so I was just messing around in Visual studio trying to make an "application" <-- if you want to call it that lol... 
that sends keys to CS:GO but I can't get it to work...
I have tried SendKeys / My.computer.keyboard.sendKeys and Keybd_event and Yes I do get it to work as in on other things like I tried it in notepad... and it works.


But it can't seem to work in game...
Im trying to do something that pretty much spams 'F' (inspect weapon) then 'R' (Reload (Cancels the inspect weapon emote))  whenever you hold CapsLock etc...
CSGO just doesn't pick it up ingame but it does if I open the console or even the Chat (pressing Y or U)
I dont know if it's because they have made it so it blocks it or what the heck is going on lol.
Any help would of greatly appreciated xD

im doing it in VB.Net (?) not in C# or C++ And yes I know it's kind of silly but im doing it more as for fun / trying to learn :p
 

HyperAim

LEM
Joined
Mar 21, 2015
Messages
323
Reaction score
32
Points
38
Swag Level :
1183
Plaii said:
Alright so I was just messing around in Visual studio trying to make an "application" <-- if you want to call it that lol... 
that sends keys to CS:GO but I can't get it to work...
I have tried SendKeys / My.computer.keyboard.sendKeys and Keybd_event and Yes I do get it to work as in on other things like I tried it in notepad... and it works.


But it can't seem to work in game...
Im trying to do something that pretty much spams 'F' (inspect weapon) then 'R' (Reload (Cancels the inspect weapon emote))  whenever you hold CapsLock etc...
CSGO just doesn't pick it up ingame but it does if I open the console or even the Chat (pressing Y or U)
I dont know if it's because they have made it so it blocks it or what the heck is going on lol.
Any help would of greatly appreciated xD

im doing it in VB.Net (?) not in C# or C++ And yes I know it's kind of silly but im doing it more as for fun / trying to learn :p
keybd_event should work.  

A detailed explanation for the function can be found both here and here.

Example to hold "F" down:
keybd_event(0x46, 0x21, KEYEVENTF_EXTENDEDKEY, 0);

Pretty sure that should work.  It will hold F down indefinitely as long as your program is open.

Another option to do this (not as safe) is SendMessage.  However, this requires an active handle to the game, so it might get detected more easily:
SendMessage(hGame, WM_KEYDOWN, 0x46, MAKELPARAM(0,0x46));  //(Obviously for this one, you need your own code to get the handle to the game)
 

Plaii

Newbie
Joined
Mar 28, 2015
Messages
5
Reaction score
0
Points
11
Swag Level :
3982
HyperAim said:
Plaii said:
Alright so I was just messing around in Visual studio trying to make an "application" <-- if you want to call it that lol... 
that sends keys to CS:GO but I can't get it to work...
I have tried SendKeys / My.computer.keyboard.sendKeys and Keybd_event and Yes I do get it to work as in on other things like I tried it in notepad... and it works.


But it can't seem to work in game...
Im trying to do something that pretty much spams 'F' (inspect weapon) then 'R' (Reload (Cancels the inspect weapon emote))  whenever you hold CapsLock etc...
CSGO just doesn't pick it up ingame but it does if I open the console or even the Chat (pressing Y or U)
I dont know if it's because they have made it so it blocks it or what the heck is going on lol.
Any help would of greatly appreciated xD

im doing it in VB.Net (?) not in C# or C++ And yes I know it's kind of silly but im doing it more as for fun / trying to learn :p
keybd_event should work.  

A detailed explanation for the function can be found both here and here.

Example to hold "F" down:
keybd_event(0x46, 0x21, KEYEVENTF_EXTENDEDKEY, 0);

Pretty sure that should work.  It will hold F down indefinitely as long as your program is open.

Another option to do this (not as safe) is SendMessage.  However, this requires an active handle to the game, so it might get detected more easily:
SendMessage(hGame, WM_KEYDOWN, 0x46, MAKELPARAM(0,0x46));  //(Obviously for this one, you need your own code to get the handle to the game)


Ye well the key gets pressed but nothing happens ingame (it doesn't inspect the weapon)
but if I open the chat ingame it does type F in it confusing as hell o.0
 

HyperAim

LEM
Joined
Mar 21, 2015
Messages
323
Reaction score
32
Points
38
Swag Level :
1183
Plaii said:
HyperAim said:
Plaii said:
Alright so I was just messing around in Visual studio trying to make an "application" <-- if you want to call it that lol... 
that sends keys to CS:GO but I can't get it to work...
I have tried SendKeys / My.computer.keyboard.sendKeys and Keybd_event and Yes I do get it to work as in on other things like I tried it in notepad... and it works.


But it can't seem to work in game...
Im trying to do something that pretty much spams 'F' (inspect weapon) then 'R' (Reload (Cancels the inspect weapon emote))  whenever you hold CapsLock etc...
CSGO just doesn't pick it up ingame but it does if I open the console or even the Chat (pressing Y or U)
I dont know if it's because they have made it so it blocks it or what the heck is going on lol.
Any help would of greatly appreciated xD

im doing it in VB.Net (?) not in C# or C++ And yes I know it's kind of silly but im doing it more as for fun / trying to learn :p
keybd_event should work.  

A detailed explanation for the function can be found both here and here.

Example to hold "F" down:
keybd_event(0x46, 0x21, KEYEVENTF_EXTENDEDKEY, 0);

Pretty sure that should work.  It will hold F down indefinitely as long as your program is open.

Another option to do this (not as safe) is SendMessage.  However, this requires an active handle to the game, so it might get detected more easily:
SendMessage(hGame, WM_KEYDOWN, 0x46, MAKELPARAM(0,0x46));  //(Obviously for this one, you need your own code to get the handle to the game)


Ye well the key gets pressed but nothing happens ingame (it doesn't inspect the weapon)
but if I open the chat ingame it does type F in it confusing as hell o.0
Turn raw input in game on/off and see if it changes
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)