SystemProperty$ ( property$ )

Parameters

property$ - name of the property to read (not case sensitive); see the list below

Description

Returns a piece of system information, such as a special folder or a runtime handle.

Useful for finding standard Windows folders, checking what the program is running on, or fetching window handles to pass to a DLL. The supported properties are:

"os" : the platform the program is running on: "Windows", "macOS", "Linux", "iOS" (on an iPhone or iPad), "Android" or "Web" (in a browser)
"cpu" : processor architecture the program is running as: "x86" or "x64" on Windows, "arm64" on a Mac, iPhone, iPad or Android device, and "wasm32" in a browser
"direct3d12" : "1" when the Direct3D 12 renderer is active, "0" otherwise
"metal" : "1" when a Mac, iPhone or iPad has graphics open, which it draws with Metal
"webgpu" : "1" when a browser or an Android device has 3D graphics open, which it draws with WebGPU
"appdir" : folder containing the program's executable; in an application on a Mac, iPhone, iPad or Android device, or in a web build, the folder that holds the program's own files
"windowsdir" : the Windows folder
"systemdir" : the Windows System folder
"tempdir" : the folder for temporary files
"datadir" : persistent writable application data folder on macOS, iOS and Android, ending with a slash; created when requested, or "" if it cannot be created. On Apple platforms this is Application Support; on Android it is the app's private files/data folder. Save here instead of the packaged "appdir". Treat mobile uninstall as loss of this data; macOS Application Support may remain after deleting the app. This folder is not a cloud save or encrypted credential store.
"apphwnd" : the program window's handle, for use with DLLs; "0" on other platforms
"apphinstance" : the application instance handle, for use with DLLs; "0" on other platforms

Any other name returns "", as does a property a platform does not have, such as "windowsdir" outside Windows. In particular, the DirectX 7 object handles that classic Blitz3D exposed (Direct3D7, Direct3DDevice7, DirectDraw7 and friends) no longer exist on the modern Direct3D 12 runtime, so asking for them returns an empty string - code that fed them to old DLLs needs rethinking rather than a different property name.

In Original mode, a folder whose name the Windows ANSI code page can't spell comes back by its short 8.3 name, as CurrentDir describes.

See also: CommandLine, GetEnv, CallDLL.

Example

; SystemProperty Example
; ----------------------

; SystemProperty returns system information as a string.

Print "Folder properties:"
Print "  systemdir    = "+SystemProperty("systemdir")
Print "  windowsdir   = "+SystemProperty("windowsdir")
Print "  tempdir      = "+SystemProperty("tempdir")
Print "  appdir       = "+SystemProperty("appdir")
Print "  datadir      = "+SystemProperty("datadir")

Print ""

; Handle properties are for advanced use with third-party DLLs
Print "Handle properties:"
Print "  apphwnd      = "+SystemProperty("apphwnd")
Print "  apphinstance = "+SystemProperty("apphinstance")

Print ""
Print "Press any key to close the example"
WaitKey

End

Index