I have made a voice control program using the SpeechRecognitionEngine class in C#.NET. It pauses and plays media by emulating a key press of a keyboards Pause/Play button. This isn’t working when a game like League of Legends is focused, I was wondering if someone could tell me why, and/or how to fix it.
case "Pause":
keybd_event(0xB3, 0, KEYEVENTF_EXTENDEDKEY, 0);
keybd_event(0xB3, 0, KEYEVENTF_KEYUP, 0);
richTextBox1.AppendText("\n Music Paused");
break;
case "Play":
keybd_event(0xB3, 0, KEYEVENTF_EXTENDEDKEY, 0);
keybd_event(0xB3, 0, KEYEVENTF_KEYUP, 0);
richTextBox1.AppendText("\n Music Played");
break;