I also ran into external applications in which SendKeys did not work for me.
As far as I can tell, some applications, such as applets inside the browser, expect to get the key down, followed by a pause, followed by a key that, I think, cannot be done using SendKeys.
I use the C # wrapper in the AutoIt library and found it pretty easy to use.
Here is a link to a quick guide that I wrote for integrating AutoIt into a C # project .
Once you have the wrapper and links, you can send "G" with the following:
private void pressG() { AutoItX3Declarations.AU3_Send("{g}"); }
or with a pause,
private void pressG() { AutoItX3Declarations.AU3_Send("{g down}", 0); AutoItX3Declarations.AU3_Sleep( 50 );
AutoIt also allows you to programmatically control the mouse.
source share