BUG: Macintosh App Quits & Computer Hangs After Menu Selection

Last reviewed: August 7, 1997
Article ID: Q140529
2.00       | 2.00
WINDOWS NT | MACINTOSH kbprg kbbuglist

The information in this article applies to:

  • Microsoft Visual C++ 2.0 Cross-Development Edition for Macintosh

SYMPTOMS

The Macintosh hangs (stops responding) after a menu is selected when you running an application created with the Visual C++ Cross-Development system.

CAUSE

If the application uses the InsertMenu function to add a menu item to a submenu using MF_BYCOMMAND, the application may fail when the menu is used. This applies to the InsertMenu function provided by the Cross-Development System, not the InsertMenu provided by the Macintosh System.

RESOLUTION

In the hmenu argument, instead of passing the root menu handle, pass InsertMenu a handle to the menu that will hold the new menu. If the menu that will hold the new menu item is added to a submenu, pass the submenu as the hmenu argument.

For example, change the following lines in the HandleCreate function of the Menu.Mac sample. This illustrates the workaround to add a pop-up menu to a submenu using MF_BYCOMMAND.

/* The original sample inserts a new top level pop-up menu */
hWndMenu = GetMenu (hwnd); InsertMenu (hWndMenu, 2, MF_POPUP|MF_BYPOSITION, (DWORD)hMenu, "States");

/* Replace these lines with the following lines to insert a pop-up menu */
/* within the Colors submenu prior to the Green menu item */
hWndMenu = GetMenu (hwnd); hSubMenu=GetSubMenu(hWndMenu,1); InsertMenu (hSubMenu, IDM_GREEN, MF_POPUP|MF_BYCOMMAND, (DWORD)hMenu,
 "States");

STATUS

Microsoft has confirmed this to be a bug in the Visual C++ 2.0 Cross Development Edition for Macintosh. We are researching the problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional reference words: 2.00 crash quit stop
KBCategory: kbprg kbbuglist
KBSubcategory: VCMac
Keywords : VCMac kbbuglist kbprg
Version : 2.00 | 2.00
Platform : MACINTOSH NT WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: August 7, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.