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/172161

From BetaArchive Wiki
Knowledge Base

How To Determining the Number of Colors Available on a Mac

Article ID: 172161

Article Last Modified on 7/1/2004


  • Microsoft FoxPro 2.5b for Macintosh
  • Microsoft Visual FoxPro 2.5c for Macintosh
  • Microsoft FoxPro 2.6a Professional Edition for Macintosh
  • Microsoft Visual FoxPro 3.0 for Macintosh

This article was previously published under Q172161


The FxGDepth() function in FoxTools returns the number of colors currently in use on a monitor from within FoxPro 2.6a for Macintosh or Visual FoxPro 3.0b for the Macintosh.


The code example below returns the version of FoxPro currently executing, load the appropriate version of FoxTools and ascertains the number of colors currently in use on the screen. Since FoxPro 2.6a places the file in the System/Extension folder, the path needs to be customized for each individual machine to correctly identify the proper hard drive name and folders:

   ****Begin Code Example****
   IF ATC("Visual",Version())>0
      SET LIBRARY TO HOME()+"FoxTools.cfm"
      SET LIBRARY TO SYS(2033,1)+""
   IF nvideocolors >0
      WAIT WINDOW "Your Monitor is running "+ALLTRIM(STR(nvideocolors)) ;
      + "colors"
      WAIT WINDOW "Your monitor is running millions of colors"
   ****End Code Example****

The FxGDepth() function returns an integer indicating the number of colors currently running on the monitor. However, setting the monitor to millions of colors causes the FxGDepth() function to return 0. To change the number of colors the monitor uses, in the Apple menu, choose Control Panels and then Monitors.

This information can be used to warn users of potential memory problems. If the machine uses millions of colors and it also has limited RAM, FoxPro 2.x or Visual FoxPro may have difficulty running successfully. To determine the amount of RAM on a Macintosh machine from within Visual FoxPro, use the FxGestalt() function.

Please note that the FxGestalt() function is available only with FoxTools.cfm shipped with Visual FoxPro for the Macintosh 3.0b.


FoxTools Help file

For additional information, please see the following article in the Microsoft Knowledge Base:

170814 Determining the Amount of Physical RAM on a Mac from VFP

Keywords: kbhowto kbcode KB172161