I was wondering if anybody could help or explain how I would go about sending keys to a game using API

I can send keys right now using the Sendkey command in Visual Basic, although I cannot send keys if the game client is maximized