Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Not an urgent issue, more a question...

Using VS2008, with a MFC/MDI project directly from the wizard; no custom code.


When opening a menu, I have this message in the output menu when opening a top level menu (when clicking on a top level menu item in the menubar).

Warning: no message line prompt for ID 0x0000.

This comes from when we (the MFC framework) try to display a message in the status bar.

Normally all menu items have IDs associated with them; but for the POPUP there is no ID, and when the framework try to get the associated string resources it fails because the ID is zero in

BOOL CMFCToolBarButton::SetACCData(CWnd* pParent, CAccessibilityData& data);

and that will call
virtual void CFrameWnd::GetMessageString(UINT nID, CString& rMessage) const;

I could override the GetMessageString method to remove the warning, but that would only hide the issue.

Is this normal ?

Any ideas ?

resource excerpt
C++
IDR_MAINFRAME MENU
BEGIN
	POPUP "&File"
	BEGIN
		MENUITEM "&New\tCtrl+N",                ID_FILE_NEW
		MENUITEM "&Open...\tCtrl+O",            ID_FILE_OPEN
		MENUITEM "&Close",                      ID_FILE_CLOSE
		MENUITEM SEPARATOR
		MENUITEM "P&rint Setup...",             ID_FILE_PRINT_SETUP
		MENUITEM SEPARATOR
		MENUITEM "Recent File",                 ID_FILE_MRU_FILE1,GRAYED
		MENUITEM SEPARATOR
		MENUITEM "E&xit",                       ID_APP_EXIT
	END
...



Thanks.

Max.
Posted
Comments
chaau 10-Sep-13 20:00pm    
I believe it only happens in Debug builds. In release mode no messages will be displayed

1 solution

When an item in a menu is 'touched', MFC attempts to display the descriptive text corresponding to the menu item based on its ID value. There are default values for some of the system-provided IDs, but not all of them, and not for any that would normally be defined by (you) the programmer.

For the example menu items you provide here, you need to add strings to describe the menu choices. In your .RC or .RC2 file, add the following section:

rc
STRINGTABLE
BEGIN
    ID_FILE_NEW             "Create a new document\nNew"
    ID_FILE_OPEN            "Open an existing document\nOpen"
    ID_FILE_CLOSE           "Close the active document\nClose"
    ID_FILE_SAVE            "Save the active document\nSave"
    ID_FILE_SAVE_AS         "Save the active document with a new name\nSave As"
    ID_FILE_PAGE_SETUP      "Change the printing options\nPage Setup"
    ID_FILE_PRINT_SETUP     "Change the printer and printing options\nPrint Setup"
    ID_FILE_PRINT           "Print the active document\nPrint"
    ID_FILE_PRINT_PREVIEW   "Display full pages\nPrint Preview"
    ID_FILE_MRU_FILE1       "Open first file\nFirst file"
    ID_APP_EXIT             "Sayonara\nBye now"
END


This is the notepad version; you can also edit with the resource editor...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900