problem with iexplorer ActiveX stealing focus

I am trying to use the inernet explorer activeX control to display a web page in a C++ application. A background thread periodically requests a refresh of the page in case it has updated. The ASP web page interrogates a SQL Server table for data when refreshed.

THE PROBLEM:

If a user is entering data in another area of the program, the explorer component steals the keyboard focus whenever it refreshes and you must click the mouse back on the editing area to continue.

Is there a way in the ActiveX to stop it stealing the focus?

Brian

[569 byte] By [bmallabon] at [2008-1-27]
# 1

Hi Brian,

Is there specific content in the page that is being refreshed that is requesting the focus?

Thanks
-Dave

DaveMassy at 2007-10-8 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 2

Not that I can see. The asp page content is very simple.

<%
strDatabase = "Provider=SQLOLEDB;Data Source=localhost;Database=AXxess;UID=sa;PWD=axxess;"
Set Db=Server.CreateObject("ADODB.Connection")
Db.Open strDatabase
SQL = "Select Title, Message, notifications.Priority FROM notifications,Priority where enable='1' AND notifications.Priority=Priority.Name ORDER BY CAST(priority.Type AS INT) DESC"
Set RS = Db.Execute(SQL)
%>
<table width="100%" border="1">
<thead>
<tr>
<td><b>Title</b></td>
<td><b>Message</b></td>
<td><b>Priority</b></td>
</tr>
</thead>
<tbody>
<tr>
<td><%= Rs("Title")%>&nbsp;</td>
<td><%= Rs("Message")%>&nbsp;</td>
<td><%= Priority%>&nbsp;</td>
</tr>
</tbody>
<% RS.MoveNext
Loop
%>
</table>

bmallabon at 2007-10-8 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...
# 3
We have experienced the same problem for a long time, where the IE activex steals focus. Our problem has nothing at all to do with any pages being loaded.
The problem occours in our application when the following lines are being executed:

IWebBrowser2 *pIWebBrowser2 = NULL;
HRESULT hr = ::CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_SERVER, IID_IWebBrowser2, (void **) &pIWebBrowser2 );

JomarJohansen at 2007-10-8 > top of Msdn Tech,Internet Explorer Development,Internet Explorer Extension Development...