Unlike most Windows programs, FREEMEM starts out life as an icon, displays everything it needs to display within the icon, and cannot be opened into a regular window. Most Windows applications have static pictorial icons that you specify in the windows class structure. These icons are usually created with the ICONEDIT utility supplied with the Windows Software Development Kit (as you'll see in Chapter 8). So far, we've been using predefined Windows icons in our programs. Alternatively, you can specify a NULL icon in the window class structure with the statement:
wndclass.hIcon = NULL ;
A NULL icon means that the application is responsible for drawing the icon. Windows sends the application WM_PAINT messages when the icon needs to be painted. Thus, a program can change the appearance of the icon while the program is running. The CLOCK application included with Windows uses this technique to display the clock even when the window is an icon. A NULL icon is really just a tiny window that you can draw on in the same way that you draw on the client area of a normal window. If you need to know when your application is becoming an icon, you can get the information from the wParam parameter of a WM_SIZE message. For instance, when CLOCK becomes an icon, it eliminates the second hand from the clock and changes the timer from a 1-second interval to a 1-minute interval.
FREEMEM displays two lines of text within its icon. This will work fine on the most common displays used for Windows, but it may not work for some high-resolution boards that may use a larger system font. Because FREEMEM cannot display correctly on these video boards, it checks the size of the system font against the icon size and uses a message box to inform the user if the icon size is too small.