The final class in this chapter provides information on, and, in a few cases, allows you to set information about, your computer and the operating system. Of course, most of the properties of the SystemInfo class (SYSTEMINFO.CLS) must be read-only. Only the Beep, ComputerName, ScreenSaverActive, and ScreenSaveTimeout properties allow you to specify a value; the rest simply return information about your environment. Table 9.25 lists all the properties of the SystemInfo class.
Table 9.25: Properties of the SystemInfo Class
Property | Datatype | Description |
ActiveProcessorMask | Long | Specifies a mask representing the set of processors configured into the system |
AllocationGranularity | Long | Specifies the granularity with which virtual memory is allocated |
Beep | Boolean | (Read/write) Turns the system warning beep on or off |
BootMethod | Long | Retrieves the boot method. Possible values: 0 (normal boot), 1 (fail-safe boot), 2 (fail-safe boot with network) |
ComputerName | String | (Read/write) Sets or retrieves the name of the computer |
IsDBCS | Boolean | Returns True if the operating system is working with DBCS characters |
IsWin95 | Boolean | Returns True if the operating system is Windows 95 |
IsWinNT | Boolean | Returns True if the operating system is Windows NT |
MaxAppAddress | Long | Pointer to the highest memory address accessible to applications and Dynamic Link Libraries (DLLs) |
MidEastEnabled | Boolean | Returns True if the system is enabled for Hebrew/Arabic languages |
MinAppAddress | Long | Pointer to the lowest memory address accessible to applications and DLLs |
NetworkPresent | Boolean | Returns True if a network is present |
NumberOfProcessors | Long | Specifies the number of processors in the system |
OSBuild | Long | Retrieves the build number of the operating system |
OSExtraInfo | String | Retrieves extra operating system information, like “Service Pack 3” |
OSMajorVersion | Long | Retrieves the major version number of the operating system. For example, for Windows NT version 3.51, the major version number is 3; for Windows NT version 4.0, the major version number is 4 |
OSMinorVersion | Long | Retrieves the minor version number of the operating system. For example, for Windows NT version 3.51, the minor version number is 51; for Windows NT version 4.0, the minor version number is 0 |
PageSize | Long | Specifies the page size and the granularity of page protection and commitment |
ProcessorArchitecture | Integer | Specifies the system’s processor architecture |
ProcessorLevel | Integer | Windows 95: not used. Windows NT: specifies the system’s architecture-dependent processor level |
ProcessorRevision | Integer | Windows 95: not used. Windows NT: specifies an architecture-dependent processor revision |
ProcessorType | Long | Windows 95: specifies the type of processor in the system. WindowsNT: uses ProcessorArchitecture, ProcessorLevel, and ProcessorRevision values |
ScreenSaverActive | Boolean | (Read/write) Sets or retrieves the state of the screen saver |
ScreenSaverTimeout | Long | (Read/write) Sets or retrieves the screen saver timeout value, in seconds |
Secure | Boolean | Returns True if security is present |
SlowMachine | Boolean | Returns True if computer has a low-end processor (definition of low-end is somewhat unclear) |
SystemDirectory | String | Retrieves the system directory. The value does not end with a trailing backslash (\) |
TempPath | String | Retrieves the temporary path. The GetTempPath function gets the temporary file path from one of the following locations: the path specified by the TMP environment variable; the path specified by the TEMP environment variable, if TMP is not defined; the current directory, if both TMP and TEMP are not defined. Path always ends with a backslash (\) |
UserName | String | Retrieves the name of the logged-in user |
WindowsDirectory | String | Retrieves the Windows directory. The value does not end with a trailing backslash (\) |
WindowsExtension | Boolean | (Win95 only) Indicates whether the Windows extension, Windows Plus!, is installed |
The properties of the SystemInfo class can be broken down into five basic categories, as shown in Table 9.26. The next section of this chapter provides more information on these categories.
Table 9.26: : Categories of SystemInfo class Properties
Category | Properties |
Computer/User | ComputerName, UserName |
Paths | SystemDirectory, TempPath, WindowsDirectory |
Processor Info | ActiveProcessorMask, AllocationGranularity, MaxAppAddress, MinAppAddress, NumberOfProcessors, PageSize, ProcessorArchitecture, ProcessorLevel, ProcessorRevision, ProcessorType |
Version | IsWin95, IsWinNT, OSBuild, OSExtraInfo, OSMajorVersion, OSMinorVersion |
Miscellaneous | Beep, BootMethod, IsDBCS, MidEastEnabled, NetworkPresent, ScreenSaverActive, ScreenSaverTimeout, Secure, SlowMachine, WindowsExtension |