afx_msg void OnSysCommand( UINT nID, LONG lParam );
nID
Specifies the type of system command requested. This parameter can be one of the following values:
Value | Description |
SC_CLOSE | Close CWnd. |
SC_HOTKEY | Activate the CWnd associated with the application-specified hot key. |
SC_HSCROLL | Scroll horizontally. |
SC_KEYMENU | Retrieve a menu through a keystroke. |
SC_MAXIMIZE (or SC_ZOOM) | Maximize CWnd. |
SC_MINIMIZE (or SC_ICON) | Minimize CWnd. |
SC_MOUSEMENU | Retrieve a menu through a mouse click. |
SC_MOVE | Move CWnd. |
SC_NEXTWINDOW | Move to the next window. |
SC_PREVWINDOW | Move to the previous window. |
SC_RESTORE | Checkpoint (save the previous coordinates). |
SC_SCREENSAVE | Executes the screen-save application specified in the Desktop section of the Control Panel. |
SC_SIZE | Size CWnd. |
SC_TASKLIST | Executes or activates the CWnd Task Manager application. |
SC_VSCROLL | Scroll vertically. |
lParam
Contains the cursor coordinates if a Control-menu command is chosen with the mouse. The low-order word contains the x-coordinate, and the high-order word contains the y-coordinate. Otherwise, this parameter is not used.
Called when the user selects a command from the Control menu or when the user selects the Maximize or Minimize button.
This message-handler member function calls the Default member function. Override this member function in your derived class to handle the WM_SYSCOMMAND message.
By default, OnSysCommand carries out the Control-menu request for the pre-defined actions specified above.
Applications that modify the Control menu must process WM_SYSCOMMAND messages, and any WM_SYSCOMMAND messages not handled by the application must be passed on to OnSysCommand. Any command values added by an application must be processed by the application and cannot be passed to OnSysCommand.
An application can carry out any system command at any time by passing a WM_SYSCOMMAND message to OnSysCommand.
Access (sometimes called “accelerator”) keystrokes that are defined to select items from the Control menu are translated into OnSysCommand calls; all other access keystrokes are translated into WM_COMMAND messages.
CWnd::Default, WM_SYSCOMMAND