BUG: Selecting DocObject Server Menu Disables IE's Menu OptionsLast reviewed: March 19, 1998Article ID: Q181677 |
The information in this article applies to:
SYMPTOMSWhen an Active Document (DocObject) server is loaded into Internet Explorer (IE) 4.0x, and a pop-up menu that is owned by the DocObject server is selected, Internet Explorer's menu options are disabled.
CAUSEThe Microsoft Foundation Classes (MFC) enables and disables menu options in its WM_INITMENUPOPUP message handler. Menu items that do not have a handler function are disabled. This is fine for menu options that are owned by the DocObject server. The problem is Internet Explorer sends a WM_INITMENUPOPUP message to the DocObject server even for menus that it does not own. This is a bug in Internet Explorer 4.0x.
RESOLUTIONA workaround is to override the WM_INITMENUPOPUP message handler in the COleDocIPFrameWnd-derived class(CInPlaceFrame) and verify that it is a menu owned by the DocObject server before calling the base class implementation:
/* ======================================================================== Name: FindMenu Purpose : Helper function for finding a submenu within a menu Arguments: hFindMenu - HMENU to look for hSearchMenu - HMENU to search in ======================================================================== */ BOOL FindMenu (HMENU hFindMenu, HMENU hSearchMenu) { BOOL bRet = FALSE; // get number of items in hSearchMenu int iMenuItemCount = GetMenuItemCount (hSearchMenu); // loop through hSearchMenu to find hFindMenu for (int iCntr=0; iCntr<iMenuItemCount; iCntr++) { // get each submenu in hSearchMenu HMENU hSubMenu = GetSubMenu (hSearchMenu, iCntr); if (hSubMenu) { // if we find a match, get out if (hFindMenu == hSubMenu) break; // recurse into FindMenu looking for hFindMenu in each submenu if (FindMenu (hFindMenu, hSubMenu)) break; } } // match found if (iCntr != iMenuItemCount) bRet = TRUE; return bRet; } void CInPlaceFrame::OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu) { COleServerDoc* pDoc = (COleServerDoc*)GetActiveDocument(); ASSERT (pDoc); // if we're created as a docobject if (pDoc->IsDocObject()) { // if submenu is not found in in-place menu, return if (FALSE == FindMenu (pPopupMenu->GetSafeHmenu(), GetInPlaceMenu())) return; } COleDocIPFrameWnd::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); } STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
|
Additional query words: ActiveX documents
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |