Microsoft KB Archive/888169

= BUG: The JScript onFocus event does not occur when the IESample browser window receives focus in Windows CE 5.0 and in Windows CE Platform Builder 4.2 =

Article ID: 888169

Article Last Modified on 12/15/2004

-

APPLIES TO


 * Microsoft Windows CE 5.0
 * Microsoft Windows CE Platform Builder 4.2

-





SYMPTOMS
The Microsoft JScript onFocus event does not occur when the IESample browser window receives focus. This problem occurs when an HTML page uses the onFocus event in the document body.



CAUSE
This problem occurs because a bug exists in the sample source code for the IESample browser that is included with Microsoft Windows CE 5.0 and with Microsoft Windows CE Platform Builder 4.2.



WORKAROUND
To work around this problem, you must modify the sample source code for the IESample browser. To do this, follow these steps:  Open the following source file:

%WinCERoot%\Public\IE\Oak\IESample\Core\Mainwnd.cpp

 Locate the CMainWnd::BrowseWndProc function. Locate the WM_SETFOCUS message in the function that you located in step 2. Change case WM_SETFOCUS: to case WM_ACTIVATE:.  The modified code will look similar to the following. LRESULT CMainWnd::BrowseWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {   CMainWnd *pMainWnd = this; if (pMainWnd) {       switch (message) {   ...        //The following is the only modified line. case WM_ACTIVATE: if (pMainWnd->_pIPActiveObj) {                 pMainWnd->_pIPActiveObj->OnFrameWindowActivate(LOWORD(wParam) != WA_INACTIVE); }           return 0; ...   }     } }  Save the source file, and then rebuild the IESample application.</li></ol>

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.

<div class="moreinformation_section">

Steps to reproduce the problem
<ol>  Create a simple HTML document that calls the JScript onFocus handler from within the tag as in the following example. <script language=&quot;JScript&quot;> function GotFocus { alert(&quot;Got focus!&quot;); } <body onFocus=&quot;GotFocus;&quot;> </li> Open the HTML document in the IESample browser. Notice that the onFocus event occurs when the document is first displayed.</li> Open another window, such as Microsoft Windows Explorer, and then close it. Notice that the onFocus event does not occur when the focus switches back to the IESample browser window.</li></ol>

Keywords: kbbug KB888169

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.