Sending Keys to Unfocused Application

Hey guys,

I am trying to send some keys to an unfocused application and every method I am trying doesn't seem to be working.

It either fails to send anything or only sends keys to the window in focus.

Can anyone provide a method for doing this? I am not trying to send text but a keystroke. Hex Code: 0x7B (F12).

Any and all help is appreciated,

Fluidz
What have you tried? I think the only method that would work on an unfocused window is the faking of WM_KEYDOWN and WM_KEYUP, but in Windows the de-facto method for automating another program is using UI Automation. If this is for another OS I just don't know what options you may have.
This is strictly windows only. I have only tried WM_CHAR and WM_KEYDOWN & WM_KEYUP but none of my methods seem to produce any kind of result whatsoever.
Last edited on
Google up UI Automation if the function that you want to trigger with F12 is accessible via a user interface element. Or see if there is a UI pattern for sending keys. Maybe there's one (don't remember right now).
Topic archived. No new replies allowed.