Holy cow, I wrote a book!
Windows 95 had a strange feature where, if you put focus
on the Start button and then hit
(That's Alt and the hyphen key),
you got a system menu for the Start button which let you close it,
and then the Start button vanished.
wondered why this existed.
This was not a feature; it was just a bug.
The person who first wrote up the code for the Start button
accidentally turned on the WS_SYSMENU style.
If you turn this style on for a child window,
Windows assigns your child window a system menu.
System menus for child windows may sound strange,
but they are actually quite normal if you are an MDI application.
And the standard hotkey for calling up the system menu of a child window
The Start button was not an MDI application, but since the
WS_SYSMENU style was set, Windows treated it
and when you pressed the hotkey, you got the system menu
which let you close the window.
(You could also move it, which was also kind of weird.)
Let's add a button with an accidental system menu to our
OnCreate(HWND hwnd, LPCREATESTRUCT lpcs)
g_hwndChild = CreateWindow(
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_SYSMENU |
BS_PUSHBUTTON | BS_CENTER | BS_VCENTER,
0, 0, 0, 0, hwnd, (HMENU)1, g_hinst, 0);
Run this program, put focus on the button, and hit
Hey look, a child window system menu.
To fix this bug, remove the WS_SYSMENU style.
That's how the Explorer folks fixed it.