Keeping the Icon an Icon

FREEMEM does not allow itself to be opened into a regular window. Would you believe this trick requires merely two simple lines in the WndProc function? Here they are:

case WM_QUERYOPEN :

return 0 ;

These two lines don't seem to be doing very much, but let's take a closer look.

Windows sends a WM_QUERYOPEN message to a program when it wants to open an icon into a window. Normally, WM_QUERYOPEN is passed on to the DefWindowProc function, which returns a nonzero value; Windows then opens the icon. With the two lines shown above, however, WndProc returns a value of 0 for a WM_QUERYOPEN message. So when Windows asks, ”Do you want to be opened?“ WndProc answers ”Zero,“ which in this case means ”No thanks.“