0

I made a trainer using Visual Studio C #, everything is working fine when changing values with buttons, but now i would like to create hotkeys which would work while im in game.

I tried this code, but it doesnt work while im in game (only when im in the Form)

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
    switch(keyData)
    {
         case Keys.F2:
             // do something...
             return true;
         case Keys.F3:
             // do something...
             return true;
         case Keys.F4:
             // do something...
             return true;
         default:
             return base.ProcessCmdKey(ref msg, keyData);
    }            
}

Can somebody help me? Thanks :D

imnoobsvk
  • 1
  • 1

1 Answers1

0

The form must be at the top in order for you to access those keyboard f keys. How about if you add to your form_Load:

this.TopMost = true;

see if that fixes. I have created a solution similar as the well known gaming voice command apps, where you can trigger any keyboard keys with your voice command in c#, i can share the code but it's too much of code and unorganized in professional ways to post here, it was for my personal use only, look up on youtube the app called: Voice Attack. There are other similar free app too.

  • I managed to do it with this: https://www.youtube.com/watch?v=-CHayQW1z8A&ab_channel=ProgrammingHOWTO if someone interested – imnoobsvk Jan 23 '22 at 10:28