Contents of the FSR.DOC file
This archive contains the C source code and executable for a Windows
utility named FSR.EXE, which tracks free system resources in real time.
When it is displayed as a window, FSR draws a horizontal bar that represents
the percentage of free system resources. The bar scales to the size of the
window, so you can make it as large or as small as you'd like. If free system
resources falls below 20 percent, the bar changes from magenta to red as a
warning. When it is reduced to an icon, FSR displays the percentage of free
system resources in numeric form. The display is updated once a second. With
FSR running, you should never again have to open Program Manager just to check
free system resources.
The heart of FSR is the function named GetFSR, which returns a DWORD
(double word) value equal to the percentage of system resources free. In
Windows 3.1, GetFSR calls the documented GetFreeSystemResources function
to get a count of free system resources. In Windows 3.0, it calls the
undocumented GetHeapSpaces function, which accepts a module handle and
returns a DWORD whose high word is equal to the number of bytes in the
default local heap and whose low word is equal to the number of free bytes
in the heap. GetFSR calls GetHeapSpaces once with the module handle of
USER and once with the module handle of GDI, computes percent free in
each module by dividing free bytes by total bytes and multiplying by 100,
and then returns the lesser of the two percentages. GetHeapSpaces was
discussed in PC Magazine's November 12, 1991, Windows column, and it is
treated at length in Undocumented Windows, by Andrew Schulman and others.
GetHeapSpaces produces erroneous results in Windows 3.1, because it does
not take into account the additional heaps set aside for USER and GDI.
If you run it under Windows 3.1, FSR adds an "Always on Top"
option to its system menu. When checked, "Always on Top" ensures that
the FSR window stays visible even if another application is running
full-screen. The program remembers how you last set it and automatically
assumes the same configuration the next time you start it.