Microsoft KB Archive/285534

= Pocket Internet Explorer Menu Is Overlaid on JScript Dialog Box =

Article ID: 285534

Article Last Modified on 5/27/2005

-

APPLIES TO


 * Microsoft Windows CE 3.0 for the Handheld PC

-



This article was previously published under Q285534



SYMPTOMS
Microsoft Pocket Internet Explorer displays message boxes behind a menu if the message boxes are created by using JScript while the menu is active. Because the menu is on top and still has the focus, it is impossible to dismiss the message box. Additionally, the menu is inoperable; menu items can be highlighted, but not selected or activated.

Under these conditions, if you click Home, the Pocket Internet Explorer menu will remain on the screen. All other menus can opened and the menu items selected and activated, but when they close, the Pocket Internet Explorer menu remains.



CAUSE
The following sequence of events occur when this problem occurs:
 * The DialogBox function calls ReleaseCapture instead of sending a WM_CANCELMODE message.
 * When the pop-up menu receives the resulting WM_CAPTURECHANGED message, it calls ExitMenuLoop, which sets a flag to signal a subsequent message loop exit.
 * When WM_CAPTURECHANGED is returned, the dialog box handler enters its own message loop, so the menu does not have the opportunity to exit.
 * Because the menu still has the focus, the dialog box can not receive any keyboard input.



WORKAROUND
To resolve this problem, use one of the following methods:  Use two separate threads for the menu and message box.  Dismiss the menu before before calling MessageBox. You can do this as shown in the following sample code: case WM_TIMER: switch (wParam) {        case 1: KillTimer(hWnd, 1); // 10 second timer to display message box SetTimer(hWnd, 2, 10000, NULL); hPopupMenu = CreatePopupMenu; AppendMenu(hPopupMenu, MF_ENABLED, 10000, TEXT(&quot;Choice 1&quot;)); AppendMenu(hPopupMenu, MF_ENABLED, 10000, TEXT(&quot;Choice 2&quot;)); AppendMenu(hPopupMenu, MF_ENABLED, 10000, TEXT(&quot;Choice 3&quot;)); AppendMenu(hPopupMenu, MF_ENABLED, 10000, TEXT(&quot;Choice 4&quot;)); AppendMenu(hPopupMenu, MF_ENABLED, 10000, TEXT(&quot;Choice 5&quot;)); AppendMenu(hPopupMenu, MF_ENABLED, 10000, TEXT(&quot;Choice 6&quot;)); AppendMenu(hPopupMenu, MF_ENABLED, 10000, TEXT(&quot;Choice 7&quot;)); AppendMenu(hPopupMenu, MF_ENABLED, 10000, TEXT(&quot;Choice 8&quot;)); AppendMenu(hPopupMenu, MF_ENABLED, 10000, TEXT(&quot;Choice 9&quot;)); AppendMenu(hPopupMenu, MF_ENABLED, 10000, TEXT(&quot;Choice 10&quot;)); TrackPopupMenu(hPopupMenu, TPM_NONOTIFY | TPM_TOPALIGN | TPM_LEFTALIGN, 200, 150, 0, hWnd, 0); break;

case 2: KillTimer(hWnd, 2); // This will cause the pop-up menu to be dismissed. // PostMessage could also be used, but this way you are // guaranteed that it willll definitely be dismissed // before the message box is displayed. SendMessage(HWND_BROADCAST, WM_CANCELMODE, 0, 0L); // After the menu is dismissed, use PostMessage // to allow TrackPopupMenu to return. PostMessage(hWnd, WM_APP, 0, 0L); }     break; case WM_APP: // At this stage the menu has completely been destroyed. MessageBox(hWnd, TEXT(&quot;Text of the Message Box&quot;), TEXT(&quot;Caption of the Message Box&quot;), MB_OK); break; 

Keywords: kbnofix kbprb KB285534

-

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

© Microsoft Corporation. All rights reserved.