please dont rip this site

WM_SYSCOMMAND Overview  Group

A window receives this message 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.


uCmdType = wParam;        // type of system command requested 

xPos = LOWORD(lParam);    // horizontal postion, in screen coordinates 

yPos = HIWORD(lParam);    // vertical postion, in screen coordinates 



Specifies the type of system command requested. This can be one of these values:




Closes the window.


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.


Selects the default item; the user double-clicked the window menu.


Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate.


Scrolls horizontally.


Retrieves the window menu as a result of a keystroke.


Maximizes the window.


Minimizes the window.


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.

lParam can have the following values:

1 means the display is going to low power.

2 means the display is being shut off.


Retrieves the window menu as a result of a mouse click.


Moves the window.


Moves to the next window.


Moves to the previous window.


Restores the window to its normal position and size.


Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file.


Sizes the window.


Executes or activates Windows Task Manager.


Scrolls vertically.

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.
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.

Return Values

An application should return zero if it processes this message.


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 Windows. 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, InsertMenu, ModifyMenu, InsertMenuItem, and SetMenuItem 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.

See Also

AppendMenu, DefWindowProc, GetSystemMenu, InsertMenu, ModifyMenu, WM_COMMAND

file: /Techref/os/win/api/win32/mess/src/msg28_9.htm, 7KB, , updated: 2000/4/7 12:20, local time: 2024/7/21 21:32,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!


After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?


Welcome to!

Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.

Welcome to!