Have made an attempt with the following steps, no menu shows yet
1. Created a resource file (in Using VS 2005)
- Went to Project Properties, Add > New > Resource File and named it Menu.rct (note, in VS2005 is rct not rc)
- Added the menu (no code was required in VS 2005)
unlike earlier version (i.e)
Code:
#include "resource.h"
IDM_MENU MENU
BEGIN
POPUP "&File"
{
MENUITEM "E&xit", ID_FILE_EXIT
}
POPUP "&Edit"
{
MENUITEM "Copy",ID_EDIT_COPY
}
POPUP "&Help"
{
MENUITEM "&About", ID_HELP_ABOUT
}
END
...and gave ID of IDR_MAINMENU
2. Edited CreateWindowEx()
Code:
wcx.lpszMenuName = MAKEINTRESOURCE(IDR_MAINMENU);
3. Added a resource.h file
Code:
#define IDR_MAINMENU 102
#define ID_FILE_EXIT 40001
#define ID_FILE_OPEN 40002
#define ID_FILE_SAVEAS 40003
#define ID_FILE_NEW 40004
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40005
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
4. WM_COMMAND
Code:
case ID_FILE_EXIT:
{
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
}
case ID_FILE_NEW:
{
//ClearEditControls(hwnd, IDC_MAIN_EDIT, "");
break;
}
case ID_FILE_OPEN:
{
// Load data from file to edit controls
DoFileOpen(hwnd);
SetValues(hwnd, &indata);
break;
}
case ID_FILE_SAVEAS:
{
// Save data on edit controls to file
DoFileSave(hwnd);
break;
}
Is there anything am missing somewhere?