The functions in this section are used to retrieve information about the current computer and/or user characteristics.
Related class group: Networking, wxPlatformInfo.
Functions | |
wxString | wxGetEmailAddress () |
Copies the user's email address into the supplied buffer, by concatenating the values returned by wxGetFullHostName() and wxGetUserId(). More... | |
bool | wxGetEmailAddress (char *buf, int sz) |
wxMemorySize | wxGetFreeMemory () |
Returns the amount of free memory in bytes under environments which support it, and -1 if not supported or failed to perform measurement. More... | |
wxString | wxGetHomeDir () |
Return the (current) user's home directory. More... | |
wxString | wxGetHostName () |
Copies the current host machine's name into the supplied buffer. More... | |
bool | wxGetHostName (char *buf, int sz) |
wxString | wxGetFullHostName () |
Returns the FQDN (fully qualified domain host name) or an empty string on error. More... | |
wxString | wxGetUserHome (const wxString &user=wxEmptyString) |
Returns the home directory for the given user. More... | |
wxString | wxGetUserId () |
This function returns the "user id" also known as "login name" under Unix (i.e. More... | |
bool | wxGetUserId (char *buf, int sz) |
wxString | wxGetUserName () |
This function returns the full user name (something like "Mr. John Smith"). More... | |
bool | wxGetUserName (char *buf, int sz) |
wxString | wxGetOsDescription () |
Returns the string containing the description of the current platform in a user-readable form. More... | |
wxOperatingSystemId | wxGetOsVersion (int *major=NULL, int *minor=NULL, int *micro=NULL) |
Gets the version and the operating system ID for currently running OS. More... | |
bool | wxCheckOsVersion (int majorVsn, int minorVsn=0, int microVsn=0) |
Returns true if the version of the operating system on which the program is running under is the same or later than the given version. More... | |
bool | wxIsPlatform64Bit () |
Returns true if the operating system the program is running under is 64 bit. More... | |
bool | wxIsPlatformLittleEndian () |
Returns true if the current platform is little endian (instead of big endian). More... | |
wxString | wxGetCpuArchitectureName () |
Returns the CPU architecture name. More... | |
wxString | wxGetNativeCpuArchitectureName () |
In some situations the current process and native CPU architecture may be different. More... | |
wxLinuxDistributionInfo | wxGetLinuxDistributionInfo () |
Returns a structure containing information about the currently running Linux distribution. More... | |
bool wxCheckOsVersion | ( | int | majorVsn, |
int | minorVsn = 0 , |
||
int | microVsn = 0 |
||
) |
Returns true if the version of the operating system on which the program is running under is the same or later than the given version.
Include file:
#include <wx/utils.h>
wxString wxGetCpuArchitectureName | ( | ) |
Returns the CPU architecture name.
This can be, for example, "x86_64", "arm64", or "i86pc". The name for the same CPU running on the same hardware can vary across operating systems.
The returned string may be empty if the CPU architecture couldn't be recognized.
wxString wxGetEmailAddress | ( | ) |
Copies the user's email address into the supplied buffer, by concatenating the values returned by wxGetFullHostName() and wxGetUserId().
Include file:
#include <wx/utils.h>
bool wxGetEmailAddress | ( | char * | buf, |
int | sz | ||
) |
buf | Buffer to store the email address in. |
sz | Size of the buffer. |
Include file:
#include <wx/utils.h>
wxMemorySize wxGetFreeMemory | ( | ) |
Returns the amount of free memory in bytes under environments which support it, and -1 if not supported or failed to perform measurement.
Include file:
#include <wx/utils.h>
wxString wxGetFullHostName | ( | ) |
Returns the FQDN (fully qualified domain host name) or an empty string on error.
Include file:
#include <wx/utils.h>
wxString wxGetHomeDir | ( | ) |
Return the (current) user's home directory.
Include file:
#include <wx/utils.h>
wxString wxGetHostName | ( | ) |
Copies the current host machine's name into the supplied buffer.
Please note that the returned name is not fully qualified, i.e. it does not include the domain name.
Include file:
#include <wx/utils.h>
bool wxGetHostName | ( | char * | buf, |
int | sz | ||
) |
buf | Buffer to store the host name in. |
sz | Size of the buffer. |
Include file:
#include <wx/utils.h>
wxLinuxDistributionInfo wxGetLinuxDistributionInfo | ( | ) |
Returns a structure containing information about the currently running Linux distribution.
This function uses the lsb_release
utility which is part of the Linux Standard Base Core
specification (see http://refspecs.linux-foundation.org/lsb.shtml) since the very first LSB release 1.0 (released in 2001). The lsb_release
utility is very common on modern Linux distributions but in case it's not available, then this function will return a wxLinuxDistributionInfo structure containing empty strings.
This function is Linux-specific and is only available when the __LINUX__
symbol is defined.
wxString wxGetNativeCpuArchitectureName | ( | ) |
In some situations the current process and native CPU architecture may be different.
This returns the native CPU architecture regardless of the current process CPU architecture.
Common examples for CPU architecture differences are the following:
The returned string may be empty if the CPU architecture couldn't be recognized.
wxString wxGetOsDescription | ( | ) |
Returns the string containing the description of the current platform in a user-readable form.
For example, this function may return strings like "Windows 10 (build 10240), 64-bit edition" or "Linux 4.1.4 i386".
Include file:
#include <wx/utils.h>
wxOperatingSystemId wxGetOsVersion | ( | int * | major = NULL , |
int * | minor = NULL , |
||
int * | micro = NULL |
||
) |
Gets the version and the operating system ID for currently running OS.
The returned wxOperatingSystemId value can be used for a basic categorization of the OS family; the major, minor, and micro version numbers allows detecting a specific system.
If on Unix-like systems the version can't be detected all three version numbers will have a value of -1.
On systems where only the micro version can't be detected or doesn't make sense, it will have a value of 0.
For Unix-like systems (wxOS_UNIX
) the major, minor, and micro version integers will contain the kernel's major, minor, and micro version numbers (as returned by the 'uname -r' command); e.g. "4", "1", and "4" if the machine is using kernel 4.1.4.
For macOS systems (wxOS_MAC
) the major and minor version integers are the natural version numbers associated with the OS; e.g. "10", "11" and "2" if the machine is using macOS El Capitan 10.11.2.
For Windows-like systems (wxOS_WINDOWS
) the major, minor and micro (equal to the build number) version integers will contain the following values:
Windows OS name | Major version | Minor version | Build number |
---|---|---|---|
Windows 11 | 10 | 0 | ≥ 22000 |
Windows Server 2022 | 10 | 0 | 20348 |
Windows 10 | 10 | 0 | |
Windows Server 2019 | 10 | 0 | 17763 |
Windows Server 2016 | 10 | 0 | 14393 |
Windows 8.1 | 6 | 3 | |
Windows Server 2012 R2 | 6 | 3 | |
Windows 8 | 6 | 2 | |
Windows Server 2012 | 6 | 2 | |
Windows 7 | 6 | 1 | |
Windows 2008 R2 | 6 | 1 | |
Windows Vista | 6 | 0 | |
Windows Server 2008 | 6 | 0 | |
Windows Server 2003 R2 | 5 | 2 | |
Windows Server 2003 | 5 | 2 | |
Windows XP | 5 | 1 |
See the Microsoft documentation for more info about the values above.
Include file:
#include <wx/utils.h>
wxString wxGetUserHome | ( | const wxString & | user = wxEmptyString | ) |
Returns the home directory for the given user.
If the user is empty (default value), this function behaves like wxGetHomeDir() (i.e. returns the current user home directory).
If the home directory couldn't be determined, an empty string is returned.
Include file:
#include <wx/utils.h>
wxString wxGetUserId | ( | ) |
This function returns the "user id" also known as "login name" under Unix (i.e.
something like "jsmith"). It uniquely identifies the current user (on this system). Under Windows or NT, this function first looks in the environment variables USER and LOGNAME; if neither of these is found, the entry UserId in the wxWidgets section of the WIN.INI file is tried.
Include file:
#include <wx/utils.h>
bool wxGetUserId | ( | char * | buf, |
int | sz | ||
) |
buf | Buffer to store the login name in. |
sz | Size of the buffer. |
Include file:
#include <wx/utils.h>
wxString wxGetUserName | ( | ) |
This function returns the full user name (something like "Mr. John Smith").
Under Windows or NT, this function looks for the entry UserName in the wxWidgets section of the WIN.INI file. If PenWindows is running, the entry Current in the section User of the PENWIN.INI file is used.
Include file:
#include <wx/utils.h>
bool wxGetUserName | ( | char * | buf, |
int | sz | ||
) |
buf | Buffer to store the full user name in. |
sz | Size of the buffer. |
Include file:
#include <wx/utils.h>
bool wxIsPlatform64Bit | ( | ) |
Returns true if the operating system the program is running under is 64 bit.
The check is performed at run-time and may differ from the value available at compile-time (at compile-time you can just check if sizeof(void*) == 8
) since the program could be running in emulation mode or in a mixed 32/64 bit system.
Include file:
#include <wx/utils.h>
bool wxIsPlatformLittleEndian | ( | ) |
Returns true if the current platform is little endian (instead of big endian).
The check is performed at run-time.
Include file:
#include <wx/utils.h>