Tech Support > Microsoft Windows > Development Resources > IWebBrowser2 focus problem
IWebBrowser2 focus problem
Posted by Sue on August 10th, 2007


Hi,

I create a modeless dialog and its child is a IWebBrowser2 window. I'm
developing a application to chat. The problem now is that if a user is
typing in one window and another window pop up since another person
ttry to chat with this person, the new window steal the focus. I try
all different ways to fix it, I used SetWindowPos with SWP_NOMOVE |
SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER | SWP_SHOWWINDOW flags and
also setfous to desktop window in Onsetfocus. Nothing works.

Is it possible that when the page is loaded in the new window, it
steal the focus? can anyone tell me how to fix this? Thanks.

Posted by Kellie Fitton on August 10th, 2007


On Aug 9, 7:21 pm, Sue <jean....@gmail.com> wrote:

Hi,

You can use the following APIs/approach to make the foreground
window disable calls to the SetForegroundWindow function:

SetForegroundWindow()

LockSetForegroundWindow()

http://msdn2.microsoft.com/en-us/library/ms633539.aspx

http://msdn2.microsoft.com/en-us/library/ms633532.aspx

Kellie.




Similar Posts