Share via


WM_SYSCOMMAND (Windows Embedded CE 6.0)

1/6/2010

This message is sent to a window when the user chooses a command from the window menu, formerly known as the system or control menu, or when the user chooses the maximize button or the minimize button.

Syntax

WM_SYSCOMMAND uCmdType = wParam; 
    xPos = LOWORD(lParam); 
    yPos = HIWORD(lParam);

Parameters

  • uCmdType
    Specifies the type of system command requested. It is one of the following values.

    Value Description

    SC_CLOSE

    Closes the window.

    SC_KEYMENU

    Retrieves the window menu as a result of a keystroke.

  • xPos
    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.
  • yPos
    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 mnemonic.

Return Value

An application should return zero if it processes this message.

Remarks

The DefWindowProc function carries out the window menu request for the predefined actions specified in the previous table.

In WM_SYSCOMMAND messages, the four low-order bits of the uCmdType parameter are used internally by the system. To obtain the correct result when testing the value of uCmdType, an application must combine the value 0xFFF0 with the uCmdType value by using the bitwise AND operator.

The menu items in a window menu can be modified by using the GetSystemMenu, AppendMenu, and InsertMenu functions. Applications that modify the window menu must process WM_SYSCOMMAND messages.

An application can carry out any system command at any time by passing a WM_SYSCOMMAND message to DefWindowProc. Any WM_SYSCOMMAND messages not handled by the application must be passed to DefWindowProc. Any command values added by an application must be processed by the application and cannot be passed to DefWindowProc.

Accelerator keys that are defined to choose items from the window menu are translated into WM_SYSCOMMAND messages; all other accelerator keystrokes are translated into WM_COMMAND messages.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 1.0 and later

See Also

Reference

Keyboard Messages
AppendMenu
DefWindowProc
GetSystemMenu
InsertMenu
WM_COMMAND