Click here to Skip to main content
13,510,309 members
Rate this:
Please Sign up or sign in to vote.
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
	POPUP "&File"
		MENUITEM "&New\tCtrl+N",                ID_FILE_NEW
		MENUITEM "&Open...\tCtrl+O",            ID_FILE_OPEN
		MENUITEM "&Close",                      ID_FILE_CLOSE
		MENUITEM "P&rint Setup...",             ID_FILE_PRINT_SETUP
		MENUITEM "Recent File",                 ID_FILE_MRU_FILE1,GRAYED
		MENUITEM "E&xit",                       ID_APP_EXIT


Posted 10-Sep-13 7:22am
Andrew Cherednik 10-Sep-13 20:00pm
I believe it only happens in Debug builds. In release mode no messages will be displayed

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:

    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"

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.180417.1 | Last Updated 10 Sep 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100