First, the System menu
1 executes commands from the system-provided window, such as maximize, close, and so on. Essentially the same as the normal menu, so we can also use this menu in the program
2 use of the system menu
2.1 Getting the System menu
GetSystemMenu
HMENU GetSystemMenu (
HWND hwnd,//window handle to get
BOOL Brevert; Get Reset Identity
);
Brevert:true Reset FALSE does not reset
When True, resets the menu to the default state and returns the menu handle, false to not reset, gets the status of the current system menu
2.2 Modify the system menu, such as Add, delete
AppendMenu
InsertMenu
Added a location for inserting menu items than AppendMenu
Removemenu
Delete a menu item
2.3 Response commands for the System menu
System Menu Response Command, really wm_syscommand in
Wparam-loword (WPARAm) to increase the ID of the menu
Second, right-click menu
1 popup menu when right button is clicked in window.
2 use of the right-click menu
2.1 Creating a Menu
Createpopmenu
2.2 Menu Additions
Appendmenu/insertmenu
2.3 Display of the menu
TrackPopupMenu
BOOL TrackPopupMenu ( HMENU HMENU, //Handle to shortcut menu UINT uflags , Options int x, //Horizontal position int y , //Vertical position int nreserved, //Reserved , must is zero hwnd hwnd, //Handle to owner window CONST RECT * prcrect //ignored);
2.4 Menu command handling
Wm_command
2.5 Where to use the right-click menu
Add menu creation and display in 2.5.1 Wm_rbuttonup
Right-click Message coordinates are converted to screen coordinates using-clienttoscreen
2.5.2 Wm_contextmenu
Message to display the right-click menu
WPARAM-the corresponding window handle when the right button is lifted
LPARAM-screen coordinates when the right button is lifted
2.5.3 Wm_rbuttonup and Wm_contextmenu contrast
1) coordinate system, Wm_rbuttonup client area coordinates wm_contextmenu screen coordinates
2) Wm_rbuttonup prior to wm_contextmenu execution