HOWTO: Use the Small Icon in Windows

ID: Q125682

The information in this article applies to:

SUMMARY

Under Windows 95, Windows 98, and Windows NT 4.0, each application is associated with two icons: a small icon (16x16) and a large icon (32x32). The small icon is displayed in the upper-left hand corner of the application and on the taskbar.

MORE INFORMATION

Large and small icons are associated with an application by using the RegisterClassEx() function. This function takes a pointer to a WNDCLASSEX structure. The WNDCLASSEX structure is similar to the WNDCLASS structure except for the addition of the hIconSm parameter, which is used for the handle to the small icon. If no small icon is associated with an application, Windows 95 will use a 16x16 representation of the large icon.

NOTE: RegisterClassEx() is not currently implemented in Windows NT where it returns NULL.

The LoadIcon() function loads the large icon member of an icon resource. To load the small icon, use the new LoadImage() function as follows:

   LoadImage(  hInstance,
               MAKEINTRESOURCE(<icon identifier>),
               IMAGE_ICON,
               16,
               16,
               0);

The small icon currently associated with the application will be displayed in the upper-left corner of the application's main window and on the task bar. Both the large and the small icon association can be changed at runtime by using the WM_SETICON message.

By default, the start menu will display the first icon defined in an application's resources. This can be changed through the start menu property sheets.

Explorer displays the first defined icon in an application's resources unless the application adds an entry to the registry under the program information called DefaultIcon or defines an icon handler shell extension for the file type. Refer to the Shell Extension documentation for more information on shell extensions.

Additional query words:

Keywords          : kbIcon kbNTOS400 kbResource kbGrpUser kbWinOS95 kbWinOS98 
Issue type        : kbhowto

Last Reviewed: January 2, 1999