Version: 2.9.4
Functions
Network, User and OS
Functions and Macros by Category

Detailed Description

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().
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.
wxString wxGetHomeDir ()
 Return the (current) user's home directory.
wxString wxGetHostName ()
 現在のホストマシン名を与えられたバッファへコピーします。
bool wxGetHostName (char *buf, int sz)
wxString wxGetFullHostName ()
 Returns the FQDN (fully qualified domain host name) or an empty string on error.
wxString wxGetUserHome (const wxString &user=wxEmptyString)
 Returns the home directory for the given user.
wxString wxGetUserId ()
 This function returns the "user id" also known as "login name" under Unix (i.e.
bool wxGetUserId (char *buf, int sz)
wxString wxGetUserName ()
 This function returns the full user name (something like "Mr. John Smith").
bool wxGetUserName (char *buf, int sz)
wxString wxGetOsDescription ()
 Returns the string containing the description of the current platform in a user-readable form.
wxOperatingSystemId wxGetOsVersion (int *major=NULL, int *minor=NULL)
 Gets the version and the operating system ID for currently running OS.
bool wxIsPlatform64Bit ()
 Returns true if the operating system the program is running under is 64 bit.
bool wxIsPlatformLittleEndian ()
 Returns true if the current platform is little endian (instead of big endian).
wxLinuxDistributionInfo wxGetLinuxDistributionInfo ()
 Returns a structure containing informations about the currently running Linux distribution.

Function Documentation

wxString wxGetEmailAddress ( )

Copies the user's email address into the supplied buffer, by concatenating the values returned by wxGetFullHostName() and wxGetUserId().

Returns:
true if successful, false otherwise.

Include file:

#include <wx/utils.h> 
bool wxGetEmailAddress ( char *  buf,
int  sz 
)
Deprecated:
Use wxGetEmailAddress() instead.
Parameters:
bufBuffer to store the email address in.
szSize of the buffer.
Returns:
true if successful, false otherwise.

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.

参照:
wxGetHostName()

Include file:

#include <wx/utils.h> 
wxString wxGetHomeDir ( )

Return the (current) user's home directory.

参照:
wxGetUserHome(), wxStandardPaths

Include file:

#include <wx/utils.h> 
wxString wxGetHostName ( )

現在のホストマシン名を与えられたバッファへコピーします。

Please note that the returned name is not fully qualified, i.e. it does not include the domain name.

Under Windows or NT, this function first looks in the environment variable SYSTEM_NAME; if this is not found, the entry HostName in the wxWidgets section of the WIN.INI file is tried.

Returns:
The hostname if successful or an empty string otherwise.
参照:
wxGetFullHostName()

Include file:

#include <wx/utils.h> 
bool wxGetHostName ( char *  buf,
int  sz 
)
Deprecated:
Use wxGetHostName() instead.
Parameters:
bufBuffer to store the host name in.
szSize of the buffer.
Returns:
true if successful, false otherwise.

Include file:

#include <wx/utils.h> 
wxLinuxDistributionInfo wxGetLinuxDistributionInfo ( )

Returns a structure containing informations 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 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 NT Version 4.0" or "Linux 2.2.2 i386".

参照:
wxGetOsVersion()

Include file:

#include <wx/utils.h> 
wxOperatingSystemId wxGetOsVersion ( int *  major = NULL,
int *  minor = 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 and minor version numbers allows to detect a specific system.

For Unix-like systems (wxOS_UNIX) the major and minor version integers will contain the kernel major and minor version numbers (as returned by the 'uname -r' command); e.g. "2" and "6" if the machine is using kernel 2.6.19.

For Mac OS X systems (wxOS_MAC) the major and minor version integers are the natural version numbers associated with the OS; e.g. "10" and "6" if the machine is using Mac OS X Snow Leopard.

For Windows-like systems (wxOS_WINDOWS) the major and minor version integers will contain the following values:

Windows OS name Major version Minor version
Windows 7 6 1
Windows Server 2008 R2 6 1
Windows Server 2008 6 0
Windows Vista 6 0
Windows Server 2003 R2 5 2
Windows Server 2003 5 2
Windows XP 5 1
Windows 2000 5 0

See the MSDN for more info about the values above.

参照:
wxGetOsDescription(), wxPlatformInfo

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.

Returns:
The login name if successful or an empty string otherwise.
参照:
wxGetUserName()

Include file:

#include <wx/utils.h> 
bool wxGetUserId ( char *  buf,
int  sz 
)
Deprecated:
Use wxGetUserId() instead.
Parameters:
bufBuffer to store the login name in.
szSize of the buffer.
Returns:
true if successful, false otherwise.

Include file:

#include <wx/utils.h> 
bool wxGetUserName ( char *  buf,
int  sz 
)
Deprecated:
Use wxGetUserName() instead.
Parameters:
bufBuffer to store the full user name in.
szSize of the buffer.
Returns:
true if successful, false otherwise.

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.

Returns:
The full user name if successful or an empty string otherwise.
参照:
wxGetUserId()

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 (bi-architecture operating system).

注:
This function is not 100% reliable on some systems given the fact that there isn't always a standard way to do a reliable check on the OS architecture.

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.

参照:
Byte Order Functions and Macros

Include file:

#include <wx/utils.h> 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines