I have problem with TWebBrowser ActiveX control. Every time WebBrowser gains focus, form stops receiving OnKeyDown/OnKeyPress/OnKeyUp events. This can be workarounded by Application.OnMessage but there's another problem. I have two controls on form, TWebBrowser and TEdit. When I click on WebBrowser, there is no way Edit can regain focus by code (i can still click on Edit ;). Edit1.SetFocus, Form1.ActiveControl and SetFocusedControl don't work.
This is a handler in ApplicationEvents.OnMessage. It doesn't work, focus remains on WebBrowser (and yes I tried - "Test" message would show)
if (GetKeyState(VK_CONTROL) < 0) and (Msg.Message = WM_KEYDOWN) and
(Msg.wParam = VK_HOME) then
Since WebBrowser is TWinControl, I suspected it may behave like TForm, but BringToFront and SetForegroundWindow API call didn't work.
Only workaround I have found by now is to hide and show a form (it is unacceptable). Is it a problem with ActiveX or something else?
I use Delphi 2006, Windows Vista x64 and IE7