J. Scott Elblein
Well-known member
Is there an 'easy' way to find out the currently focused application on the users screen, and set focus back to it once you have done something to take focus off?
To elaborate a bit, I am using sendkeys to send strings and keyboard commands to a process in the background. This inevitably sets focus to that window for a second, so i would like to automatically have the previously focused window set back to focus, once the string is sent. (The sendkeys stuff is already taken care of).
I remember having to use findwindow/getforegroundwindow/setforegroundwindow api's in classic vb, but knowing .NET was designed to make life a bit easier, was wondering (hoping) for a class or something that could do this now?
Thanks in advance!
To elaborate a bit, I am using sendkeys to send strings and keyboard commands to a process in the background. This inevitably sets focus to that window for a second, so i would like to automatically have the previously focused window set back to focus, once the string is sent. (The sendkeys stuff is already taken care of).
I remember having to use findwindow/getforegroundwindow/setforegroundwindow api's in classic vb, but knowing .NET was designed to make life a bit easier, was wondering (hoping) for a class or something that could do this now?
Thanks in advance!