WebBrowser lost Key input focus after close Find dialog

WebBrowser lost Key input focus after close Find dialog

Post by Mike » Fri, 08 Jul 2005 06:03:25

I use SDI host WebBrowser, and in one of its parent window(derived from
CWnd) using

BOOL CMyBaseWnd::PreTranslateMessage(MSG* pMsg)
if (IsDialogMessage(pMsg))
return TRUE;
return CWnd::PreTranslateMessage(pMsg);

to get Keyboard Ctrl+ key input.
First time, Ctrl+F , it invokes Find dialog, every thing works fine. Then I
close the Find Dialog.
Press Ctrl+F, nothing happend. If use the LButton click the view, then
Ctrl+F, again I can open the Find Dialog.

I can see the WM_KEYDOWN event before IsDialogMessage. I guess, after close
the Find Dialog, the WebBrowser does not get focus automatically. The Key
Down message losts in somewhere. Mouse event can still get through.

Does any one know how can I solve the problem?


Mike J

1. tab key, Win32, input focus and modeless dialog

2. ListView losing focus after returning from a closed dialog

When I select a list item from the listbox which creates another
dialog box, the list item loses focus (grayed out) when the dialog box
is closed. What should I do to re-instate the focus on the list item?

My code snippet is as follows:
private void Results_SelectedIndexChanged(object sender,
System.EventArgs e)
if (Results.FocusedItem != null)
string FarmId = Results.FocusedItem.Text;
FarmRecordEntry record = new FarmRecordEntry();

conn = new SqlCeConnection ("Data Source = " + sdfFilePath);

// Getting details of the farm selected...
record = getFarmRecord(FarmId, conn, record);
FarmModuleForm1 farmModule = new FarmModuleForm1(FarmId, record);

3. After closing thread with dialog focus partially lost

4. what's the proper way to close a popup modalless dialog when it lost focus?

5. IE6 losing focus when pressing enter key in an input box

6. VBA code causes Find and Replace dialog box to lose focus

7. Find and Replace dialog loses focus constantly, erratically

8. Key focus stays on toolbar when input focus is shifted

9. Webbrowser textbox loses focus

10. VB.NET for webbrowser control losing focus and failing?

11. Managed WebBrowser Control focus gets lost in textbox (Windows.Forms 2.0)

12. Why Find Dialog in IE cannot focus on the finding string?

13. Closing the dropdown using Esc key results in closing of dialog

14. Intercept Lost"focus" without losing focus...

15. The WebBrowser control cann't receive key inputs