Registrations are now open. Join us today!
There is still a lot of work to do on the wiki yet! More information about editing can be found here.
Already have an account?

Microsoft KB Archive/170814

From BetaArchive Wiki
Knowledge Base

How To Determining the Amount of Physical RAM on a Mac from VFP

Article ID: 170814

Article Last Modified on 6/30/2004


  • Microsoft Visual FoxPro 3.0b for Macintosh

This article was previously published under Q170814


There is no function available in Visual FoxPro for the Macintosh that provides information on the amount of physical RAM on the machine. However, the Ram selector of the FxGestalt()function in the FoxTools.cfm library provides information on the amount of physical RAM installed on a machine.


The following code example returns the amount of physical RAM installed on the machine. The function ignores any virtual memory. This code returns an integer indicating the amount of physical RAM.

In the Command window or a program, enter the following lines of code:

   SET LIBRARY TO Home()+"foxtools.cfm"
   i=FxGestalt("ram ",@ram_amt)
   ? INT(ram_amt/1024/1024)

Notice a space exists after the "Ram" selector in the FxGestalt function. Omitting this space causes the function to fail and return a -1.

All the selectors of the FxGestalt function are four letters long. The Help file states this fact in the Syntax section. The example in the FoxTools Help file, however, is not quite clear on this point. Since the space character is not easily seen in the example, it is easy to overlook it.


FoxTools Help file located in the Microsoft Visual FoxPro:Tools folder

Keywords: kbhowto KB170814