If i have a DirectX game running in a window, is it possible to send key presses to this game window so that the game listens to them?

Does anybody have any sample code?

thanks!