Well, you have to use:

SetForegroundWindow(handle);
SetFocus(handle);

I can't figure out how to send keys without the window showing the window first. If anyone knows how I would like a reply please! Anyhow, use keybd_event(); like this:

/* Once you have set the foreground window & the focus: */

keybd_event("I", 0, 0, 0);
keybd_event("I", 0, KEYEVENTF_KEYUP, 0);


I hope this is what you were wanting!