This message is sent when the user selects a command from the System menu or when the user selects the maximize or minimize box.
Parameter | Description |
wParam | Specifies the type of system command requested. It can be any one of the following values: | ||
Value | Meaning | ||
SC_CLOSE | Close the window. | ||
SC_HOTKEY | Activate a window in response to the user pressing a hotkey. | ||
SC_HSCROLL | Scroll horizontally. | ||
SC_KEYMENU | Retrieve a menu through a key stroke. | ||
SC_MAXIMIZE (or SC_ZOOM) | Maximize the window. | ||
SC_MINIMIZE (or SC_ICON) | Minimize the window. | ||
SC_MOUSEMENU | Retrieve a menu through a mouse click. | ||
SC_MOVE | Move the window. | ||
SC_NEXTWINDOW | Move to the next window. | ||
SC_PREVWINDOW | Move to the previous window. | ||
SC_RESTORE | Checkpoint (save the previous coordinates). | ||
SC_SCREENSAVE | Executes or activates the Windows Screen Saver application. | ||
SC_SIZE | Size the window. | ||
SC_TASKLIST | Executes or activates the Windows Task Manager application. | ||
SC_VSCROLL | Scroll vertically. | ||
lParam | Contains the cursor coordinates if a System-menu command is chosen with the mouse. The low-order word contains the x-coordinate, and the high-order word contains the y-coordinate. If wParam is SC_HOTKEY, the low-order word contains the handle of the window to be activated. Otherwise, this parameter is not used. |
The DefWindowProc function carries out the System-menu request for the predefined actions specified above.
In WM_SYSCOMMAND messages, the four low-order bits of the wParam parameter are used internally by Windows. When an application tests the value of wParam, it must combine the value 0xFFF0 with the wParam value by using the bitwise AND operator to obtain the correct result.
The menu items in a System menu can be modified by using the GetSystemMenu, AppendMenu, InsertMenu, and ModifyMenu functions. Applications that modify the System menu must process WM_SYSCOMMAND messages. Any WM_SYSCOMMAND messages not handled by the application must be passed to the DefWindowProc function. Any command values added by an application must be processed by the application and cannot be passed to DefWindowProc.
An application can carry out any system command at any time by passing a WM_SYSCOMMAND message to the DefWindowProc function.
Accelerator key strokes that are defined to select items from the System menu are translated into WM_SYSCOMMAND messages; all other accelerator key strokes are translated into WM_COMMAND messages.