As it is necessary to do things, we try to implement the menu bar.
First, add the menu item options (buttons) in (resource. h)
// "Edit menu"
# Define idm_editcopy 211 // copy.
# Define idm_editpaste 212 // Paste
// Help menu
# Define idm_about 221 // about
# Define idm_game1 222 // games
# Define idm_game2 223 //
# Define idm_game3 224
Add the following code to the resource file (the file ending with. Rc:
// Define menu resources below
Menuappmenu menu discardable // menu identifier
Begin
Popup "file (& F )"
Begin
Menuitem "New (& n)", idm_new
Menuitem separator // separator bar
Menuitem "exit (& X)", idm_exit
End
Popup "Edit (& E )"
Begin
Menuitem "Copy (& C)", idm_editcopy
Menuitem Separator
Menuitem "paste (& P)", idm_editpaste, grayed
// The start is gray and unavailable
End
Popup "games (& S )"
Begin
Menuitem "game1 (g)", idm_game1
Menuitem "game2 (m)", idm_game2
Menuitem "game3 (E)", idm_game3
End
Popup "Help (& H )"
Begin
Menuitem "about (& A)... \ TF1", idm_about
End
End
However, to display the menu items, add the following to the CPP file (winmain:
Wndclass. lpszmenuname = "menuappmenu"; if you do not want to display the menu, you can
Wndclass. lpszmenuname = NULL;
---- Record the details