Microsoft KB Archive/140529

From BetaArchive Wiki

BUG: Macintosh App Quits & Computer Hangs After Menu Selection

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          : kbMAC kbVC kbbuglist
Version           : 2.00       | 2.00
Platform          : MACINTOSH NT WINDOWS

Last Reviewed: August 10, 1997
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.