GetSystemMenu取得菜单句柄<br>ModifyMenu修改菜单项<br>DeleteMenu删除菜单项<br>AppEndMenu添加菜单项<br>用户点击菜单项时范例捕获wm_SysCommand消息来触发自定义事件<br><br>The GetSystemMenu function allows the application to access the window menu (also known as the System menu or the Control menu) for copying and modifying. <br><br>HMENU GetSystemMenu(<br><br> HWND hWnd, // handle of window to own window menu <br> BOOL bRevert // reset flag<br>  
;<br><br>The ModifyMenu function has been superseded by the SetMenuItemInfo function. You can still use ModifyMenu, however, if you do not need any of the extended features of SetMenuItemInfo.<br><br>BOOL ModifyMenu(<br><br> HMENU hMnu, // handle of menu <br> UINT uPosition, // menu item to modify<br> UINT uFlags, // menu item flags <br> UINT uIDNewItem, // menu item identifier or handle of drop-down menu or submenu<br> LPCTSTR lpNewItem // menu item content <br>  
;<br><br>The DeleteMenu function deletes an item from the specified menu. If the menu item opens a menu or submenu, this function destroys the handle to the menu or submenu and frees the memory used by the menu or submenu. <br><br>BOOL DeleteMenu(<br><br> HMENU hMenu, // handle to menu<br> UINT uPosition, // menu item identifier or position<br> UINT uFlags // menu item flag<br>  
;<br><br>The AppendMenu function has been superseded by the InsertMenuItem function. You can still use AppendMenu, however, if you do not need any of the extended features of InsertMenuItem.<br><br>BOOL AppendMenu(<br><br> HMENU hMenu, // handle to menu to be changed<br> UINT uFlags, // menu-item flags<br> UINT uIDNewItem, // menu-item identifier or handle of drop-down menu or submenu<br> LPCTSTR lpNewItem // menu-item content<br>  
;<br><br><br>A window receives this message when the user chooses a command from the window menu (also known as the System menu or Control menu) or when the user chooses the Maximize button or Minimize button.<br><br>WM_SYSCOMMAND <br>uCmdType = wParam; // type of system command requested <br>xPos = LOWORD(lParam); // horizontal postion, in screen coordinates <br>yPos = HIWORD(lParam); // vertical postion, in screen coordinates <br> <br><br>Parameters<br><br>uCmdType<br><br>Specifies the type of system command requested. This can be one of these values:<br><br>Value Meaning<br>SC_CLOSE Closes the window.<br>SC_CONTEXTHELP Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message.<br>SC_DEFAULT Selects the default item; the user double-clicked the window menu.<br>SC_HOTKEY Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate.<br>SC_HSCROLL Scrolls horizontally.<br>SC_KEYMENU Retrieves the window menu as a result of a keystroke.<br>SC_MAXIMIZE (or SC_ZOOM) Maximizes the window.<br>SC_MINIMIZE (or SC_ICON) Minimizes the window.<br>SC_MONITORPOWER Windows 95 only: Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.<br>SC_MOUSEMENU Retrieves the window menu as a result of a mouse click.<br>SC_MOVE Moves the window.<br>SC_NEXTWINDOW Moves to the next window.<br>SC_PREVWINDOW Moves to the previous window.<br>SC_RESTORE Restores the window to its normal position and size.<br>SC_SCREENSAVE Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file.<br>SC_SIZE Sizes the window.<br>SC_TASKLIST Executes or activates Windows Task Manager.<br>SC_VSCROLL Scrolls vertically.<br> <br>xPos<br>Specifies the horizontal position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. Otherwise, the xPos parameter is not used.<br><br>yPos<br>Specifies the vertical position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. This parameter is -1 if the command is chosen using a system accelerator, or zero if using a mnenomic.<br><br>Return Values<br>An application should return zero if it processes this message.<br><br>