Types of Resources

For your Windows 98 applications, the following resources are available:

On the Use of Resources

Because my tech reviewer has raised a few important questions concerning limitations on resources (there really aren’t any), I’m repeating the questions here with approximate answers.

Q:How much free memory can be used for resources?

A:All of it. In theory, the only limitation—under any 32-bit version of Windows—is the 4GB limit on addressable memory. Remember, that the operating system uses roughly 12MB of RAM, but the swap file acts as an extension to system RAM. Therefore, on a 16MB system, somewhere in the neighborhood of 20MB–30MB of RAM are available for resources. How much you use is entirely up to your application design. (And, yes, you could use a 2GB or 3GB hard drive as a dedicated swap file—why not, they’re cheap now and relatively fast if you really need that much space.)

Q:List everything that is considered a resource.

A:List everything that isn’t provided directly by your C/C++ source code. A resource—in addition to bitmaps, icons, toolbars, dialog templates, hotkey accelerators, string tables, and custom cursors—may include data objects, such as a database template, custom controls, default registry data, sound files (but these are usually external), or anything else you desire to include as a custom resource.

Q:How time-consuming is it to load and unload resources?

A:In actual fact, it isn’t. Resources are part of the application’s .EXE file (or .DLL library) and are loaded at the same time the executable runs. If there is insufficient free memory, some part of the executable or DLL is transferred to the swap file. This task is handled by Windows on a demand basis such that currently unneeded elements are off-loaded to a disk image of RAM and are recalled (moved back into active memory) when needed. In effect, there is no real way to say what the time constraints are except to observe that fast hard drives are more responsive than slow ones.

Q:Besides memory, what are the limitations on how many resources can be loaded at one time?

A:For all practical purposes, memory aside, there are none.

While application resources are, nominally, contained in the .RES resource script file during development, binary resource objects—such as bitmaps, cursors, and icons among others—are stored separately as individual files. Also, several custom file types can be used to store individual resource objects separate from the resource script.

© 1998 SYBEX Inc. All rights reserved.