WM_SYSCOMMAND oddities
Posted
by Andreas Rejbrand
on Stack Overflow
See other posts from Stack Overflow
or by Andreas Rejbrand
Published on 2010-05-02T22:07:08Z
Indexed on
2010/05/02
22:38 UTC
Read the original article
Hit count: 202
An application recieves the WM_SYSCOMMAND message when the user selects a menu item command on the system menu, and so wParam can be SC_CLOSE, SC_CONTEXTHELP, SC_MAXIMIZE, SC_MINIMIZE, SC_RESTORE etc. That's logical.
But one can also send the WM_SYSCOMMAND message to send commands to the Windows Shell. For instance, one can display the start menu (SC_TASKLIST), activate the screen saver (SC_SCREENSAVE), and turn off the monitor (SC_MONITORPOWER). This does not make sense, does it? What does this have to do with the application's system menu? This is more of a "system command", i.e. more of a completely other interpretation of the name "WM_SYSCOMMAND" of the message. It's like the message is used to send command requests to the system.
Why is this message used for two seemingly entirely different things, and what thing does the name "SYSCOMMAND" refer to (command on the system menu, or command of the operating system)?
© Stack Overflow or respective owner