Click here to Skip to main content
11,479,951 members (58,952 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC menu resources
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
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 10-Sep-13 8:22am
Maximilien75.8K
Comments
Andrew Cherednik at 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
good
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:

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...
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 235
1 Sergey Alexandrovich Kryukov 215
2 Richard MacCutchan 100
3 F-ES Sitecore 85
4 DamithSL 65
0 Sergey Alexandrovich Kryukov 7,890
1 OriginalGriff 7,556
2 Sascha Lefèvre 3,064
3 Maciej Los 2,491
4 Richard Deeming 2,335


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 10 Sep 2013
Copyright © CodeProject, 1999-2015
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