Background Input

Hi, this is my first topic. I’m making a program that mirrors the RetroArch window into a game (Garry’s Mod) and I would like the player to be able to use RetroArch in-game. Since the player’s foreground window is the game and not RetroArch, none of their keyboard input gets registered by RetroArch. Is there some type of setting or driver that allows for background input for RetroArch? I’ve even tried using WinAPI functions SendMessage to send keystrokes to the emulator, but that didn’t work. Any ideas? Thank you.