Carrying out a function every time enter is pressed.

BroBanKata

New member
Joined
Dec 20, 2019
Messages
3
Programming Experience
Beginner
Hello,

I have literally no experience in C# but knowing how: if, while, for, etc. statements work. I've been trying to create a console based app that would press enter every time enter is pressed... This might be confusing so let me break it down a little so you can understand. The application would run in the background and every time enter is pressed the app would press it again so essentially one enter click = 2 enter clicks. And now I have 2 questions: Is it something I would be able to create with no experience and research alone? Can anyone give me some basic ideas how to even approach trying to make this code?
 
What would be the purpose of such functionality?
I'm a league of legends player. In league of legends enter key cannot be rebound to anything other than chat button but also unfortunately you cannot remove that bind. I'm really "toxic" when I'm angry at the game so just to avoid getting banned again I want to make an app that would run in the background. Double click enter does nothing in league of legends it just opens and closes the chat. This might sound stupid because I could always close close the app. This is true however just having that app there I think it would remind me not to trash talk every time I would try to close it. Also maybe in a future when I'm a better programmer I could further develop it so it cannot be closed while leagueoflegends.exe is running.
 
Go low tech. Tape on a cotton ball on top of your Enter key when start the game.
 
Or just don't play a game that takes away your self control...
I just didn't want to make my post too complicated. The app wouldn't be for me but for my friend that asked me for it. It was just so much easier to write a post talking about my self and not saying my friend wanted bla bla bla.
 
Ok no problem. So then, to answer your questions.
Is it something I would be able to create with no experience
No, its not.
Can anyone give me some basic ideas how to even approach trying to make this
In a nutshell; you would need a listener for your application to listen for global key strokes and intercept them accordingly. What you are asking would require getting a handle on your game window and I don't consider this simple for a beginner to achieve.

A typical approach would be to take control by installing your first hook with WH_KEYBOARD_LL. That's how I would start, since WH_KEYBOARD which is a different API will likely require you to take some additional steps to get moving. If I recall, the later would require you to register a DLL project which would later be used to inject into your hooked application. In this case; your Game window. This would be a very complicated task for some intermediates, so no, I don't think you can do this yourself, especially if you have no experience with PINVOKE. Your starting point would be to find out more by searching the API's I mentioned.

You should also pay attention to Riot Anti Cheat, while admittedly, I don't know a lot about it, but If it is like any other anti cheat, you might want to avoid hooking windows and injecting as there is a possibility you may be banned for suspect cheating.
 
Back
Top Bottom