Comment 468 for bug 263435

Revision history for this message
In , Igor-levicki (igor-levicki) wrote :

Few caveats regarding Windows code:

1. If you call SetFocus() API, it internally sends WM_KILLFOCUS to the current focus owner, and WM_SETFOCUS to a window whose HWND you passed in. That means it is not necessary to kill focus manually first, because it is done automatically.

2. If Firefox does not set parent window for plugins (which I doubt it can do anyway), your GetParent() call may return NULL. In that case, SetFocus() won't work.

3. GetFocus() returns window handle only if that window is attached to the calling thread's message queue which I doubt to be the case for plugins.

So, most likely a proper way to SetFocus() would be to find browser window's HWND by using some built-in method from the browser code itself.