Chapter 8 Icons, Cursors, Bitmaps, and Strings

Most Windows programs include a customized icon that Windows displays when the program is minimized. Some programs (such as the Windows PAINTBRUSH program) also use customized cursors to represent different operations of the program. Most Windows programs also use menus and dialog boxes.

Icons, cursors, menus, and dialog boxes are all examples of ”resources.“ Resources are data and are included in a program's .EXE file, but they do not reside in a program's normal data segment. When Windows loads a program into memory for execution, it usually leaves the resources on disk. Only when Windows needs a particular resource does it load the resource into memory. (You've probably noticed dynamic loading of resources when working with Windows programs. When you invoke a program's dialog box for the first time, Windows usually accesses the disk to copy the dialog box resource from the program's .EXE file into memory.)

Most resources are read-only data and are marked as discardable. When Windows needs more memory, segments occupied by discardable resources can be freed up. If the resource is required again later, Windows reloads it from the .EXE file. Just as multiple instances of the same program share the same code, multiple instances also usually share resources. I'll be discussing these resources:

Icons

Cursors

Bitmaps

Character strings

User-defined resources

Menus

Keyboard accelerators

Dialog boxes

Fonts

The first five resources in the list are discussed in this chapter. Menus and keyboard accelerators are covered in Chapter 9, dialog boxes in Chapter 10, and fonts in Chapter 14.