2007-01-04, 09:38 AM
Hi,
I have a problem I have struggled with for more than two days now and cannot seem to get around I am sure its possible I just have not worked it out yet :-(
I have an application that has been launched by the plugin and I can receive a key from a remote and translate that into a set of keys that need to be sent to the previously launched application. I use SetForeGroundWindow to send the launched application back to the front and then I have tried various methods to send the key sequence to the launched application. sendkeys doesnt seem to work at all.
However I have had some joy with SendInput; in that if I send the keys with the KeyDown and never do a KeyUP then the application receives them over and over.... :-(
I therefore believe it is a timing issue, I send the launched application to the foreground but I have no way (currently) of checking if it is there yet before I send my keys to it. I therefore am working on the premise that I require a way of checking if the launched application is the focused/foreground application, looping until it is and then sending my key sequence. I have tried GetForeGroundWindow but to be honest I got completly in a mucking fuddle.
Anybody got some help or a snip of code they could offer?
Thanks
I have a problem I have struggled with for more than two days now and cannot seem to get around I am sure its possible I just have not worked it out yet :-(
I have an application that has been launched by the plugin and I can receive a key from a remote and translate that into a set of keys that need to be sent to the previously launched application. I use SetForeGroundWindow to send the launched application back to the front and then I have tried various methods to send the key sequence to the launched application. sendkeys doesnt seem to work at all.
However I have had some joy with SendInput; in that if I send the keys with the KeyDown and never do a KeyUP then the application receives them over and over.... :-(
I therefore believe it is a timing issue, I send the launched application to the foreground but I have no way (currently) of checking if it is there yet before I send my keys to it. I therefore am working on the premise that I require a way of checking if the launched application is the focused/foreground application, looping until it is and then sending my key sequence. I have tried GetForeGroundWindow but to be honest I got completly in a mucking fuddle.
Anybody got some help or a snip of code they could offer?
Thanks