Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

_Dos, _Mac, _Unix, _Windows

These system variables tell you which platform FoxPro is running on. In Visual FoxPro for Windows, _WINDOWS is true and the rest are false. In VFP/Mac, _MAC is .T. If we ever see Visual FoxPro for the other platforms, we expect we’ll see the matching system variables set true, but we’re not holding our breath.

Usage

lIsDos = _DOS
lIsMac = _MAC
lIsUnix = _UNIX
lIsWindows = _WINDOWS

Back when cross-platform meant more than Windows 95 and Windows NT, these variables were useful for cross-platform development. They allowed you to bracket platform-specific code so it didn’t cause errors on the other platforms.

Example

DO CASE
CASE _WINDOWS
   MODIFY WINDOW screen FONT "Arial",10
CASE _MAC
   HIDE WINDOW screen
ENDCASE

See Also

OS()