Reputation: 14105
Say your automating Firefox, and you want to do crazy things like, emulating a raw keystroke typing 'return' but to a tab window that is not currently in focus/active/ontop.
Using ideas in https://developer.mozilla.org/en/Code_snippets/Finding_Window_Handles you can get a hwnd, and then do something like
::PostMessage(hWND, WM_KEYDOWN, VK_RETURN, 0);
::PostMessage(hWND,WM_CHAR,VK_RETURN,0);
::PostMessage(hWND, WM_KEYUP, VK_RETURN, 0);
However according to that same link in Gecko 2.0 (Firefox 4 & others) there will no longer be a windows native hwnd representing each tab.
Having various automation actions I wish to take, I'm trying to work out if there is some replacement way to send windows messages to a tab that is not currently focused?
or will require a larger re write to replace these actions with some other more 'gecko native' process?
Upvotes: 0
Views: 477
Reputation: 55392
If you want to interact with Firefox out-of-process then the only way I know of that's supported are the accessibility APIs.
If you're writing an extension then you can simply create a keypress event with the relevant key or character code and dispatch it to the appropriate element.
Upvotes: 1