xsystem Class Reference

BASE CLASS FOR THE HOST OPERATING SYSTEM. More...

#include <Zclassut.h>

List of all members.

Public Member Functions

void ChangeFolder (LPCTSTR folder_name)
xstring CurrentFolder (void)
int Message (LPCTSTR message=_T("?"), LPCTSTR title=_T("Message"), int style=MB_ICONINFORMATION)
int WarningMessageYesNo (LPCTSTR message, LPCTSTR title=_T("Warning"))
int WarningMessageNoYes (LPCTSTR message, LPCTSTR title=_T("Warning"))
int WarningMessageYesNoCancel (LPCTSTR message, LPCTSTR title=_T("Warning"))
void FatalMessage (LPCTSTR message)
void WarningMessage (LPCTSTR message)
void CommonControlsInit (void)
void Beep (int sound=-1)
int WaveInputDevicesCount (void)
int WaveOutputDevicesCount (void)
unsigned long OSPlatform (void)
bool isNT (void)
bool isWindowsVista (void)
bool isWindows7 (void)
bool isServer2008R2 (void)
bool isServer2008 (void)
bool isServer2003 (void)
bool isServer2003R2 (void)
bool isWindowsXP (void)
bool isWindows2000 (void)
bool isWindows98 (void)
bool isWindowsME (void)
bool isWindows95 (void)
unsigned long OSVersionBuild (void)
unsigned long OSVersionMinor (void)
unsigned long OSVersionMajor (void)
HRESULT CommonControlsVersion (void)
unsigned long CommonControlsMajor (void)
unsigned long CommonControlsMinor (void)
bool isCommonControls_40 (void)
bool isCommonControls_IE470 (void)
bool isCommonControls_IE471 (void)
bool isCommonControls_IE472 (void)
xstring Date (TCHAR date_format=DDsMMsYYYY)
xstring Time (TCHAR time_format=HHsMMsSS)
bool CopyFile (LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, bool bFailIfExists=__yes)
bool DeleteFile (LPCTSTR lpFileName)
bool MoveFile (LPCTSTR source, LPCTSTR destination)
bool FileAttributes (LPCTSTR lpFileName, unsigned long dwFileAttributes)
bool DeleteFolder (LPCTSTR folder_name, LPCTSTR seed=_T("*.*"), bool recursive=true, bool delete_folder=true)
bool LockWindow (HWND window_handle)
bool UnlockWindow (void)
void ViewLastError (LPCTSTR remark, unsigned long error)
bool RemoveFolder (LPCTSTR folder_name)
bool RenamePath (LPCTSTR oldname, LPCTSTR newname)
xstring TempFile (LPCTSTR folder, LPCTSTR prefix)
xstring ReadProfile (LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpDefault, LPCTSTR lpFileName)
void WriteProfile (LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpString, LPCTSTR lpFileName)
bool CreateFolder (LPCTSTR folder_name)

Public Attributes

bool verbose
unsigned long error_code

Detailed Description

BASE CLASS FOR THE HOST OPERATING SYSTEM.

Provides methods for managing the operating system.


Member Function Documentation

void xsystem::Beep ( int  sound = -1  )  [inline]

Plays a waveform sound. The waveform sound for each sound type is identified by an entry in the [sounds] section of the registry.

Parameters:
sound - specifies the sound type,as identified by an entry in the [sounds] section of the registry. This parameter can be one of the following values:

  • 0xFFFFFFFF - Standard beep using the computer speaker
  • MB_ICONASTERISK - SystemAsterisk
  • MB_ICONEXCLAMATION - SystemExclamation
  • MB_ICONHAND - SystemHand
  • MB_ICONQUESTION - SystemQuestion
  • MB_OK - SystemDefault
void xsystem::ChangeFolder ( LPCTSTR  folder_name  ) 

Changes the current directory for the current process If the function succeeds,the return value is true. To get extended error information,call xsystem::ViewLastError method.

void xsystem::CommonControlsInit ( void   ) 

Initializes the Common Controls Library COMCTRL32 CAUTION: this method is always executed by the xmodule::Start method

unsigned long xsystem::CommonControlsMajor ( void   )  [inline]
Returns:
the major version number of the Common Controls Library COMCTRL32.
unsigned long xsystem::CommonControlsMinor ( void   )  [inline]
Returns:
the minor version number of the Common Controls Library COMCTRL32.
HRESULT xsystem::CommonControlsVersion ( void   ) 

Retrieves the DLL version of the Common Controls Library COMCTRL32. CAUTION: this method is always executed by the xmodule::Start method. Use the following methods to obtain the version number:

  • isCommonControls_40
  • isCommonControls_IE470
  • isCommonControls_IE471
  • isCommonControls_IE472
  • CommonControlsMajor
  • CommonControlsMinor
bool xsystem::CopyFile ( LPCTSTR  lpExistingFileName,
LPCTSTR  lpNewFileName,
bool  bFailIfExists = __yes 
)

Copies an existing file to a new file. If the function succeeds,the return value is true.

Parameters:
lpExistingFileName - Specifies the name of an existing file.
lpNewFileName - Specifies the name of the new file.
bFailIfExists - Specifies how this operation is to proceed if a file of the same name as that specified by lpNewFileName already exists. If this parameter is TRUE and the new file already exists,the function fails. If this parameter is FALSE and the new file already exists,the function overwrites the existing file and succeeds.
bool xsystem::CreateFolder ( LPCTSTR  folder_name  ) 

Creates a new directory. If the function succeeds,the return value is true. To get extended error information,call xsystem::ViewLastError method.

xstring xsystem::CurrentFolder ( void   ) 
Returns:
the current directory for the current process.
xstring xsystem::Date ( TCHAR  date_format = DDsMMsYYYY  ) 

Gets the current system date

Parameters:
date_format - This parameter can be one of the following values: (i.e. the current system date is 1 May 2001)

  • DDMMYYYY - the string will be 01052001
  • MMDDYYYY - the string will be 05012001
  • YYYYMMDD - the string will be 20010501
  • DDsMMsYYYY - the string will be 01/05/2001
  • MMsDDsYYYY - the string will be in the form 05/01/2001
  • YYYYsMMsDD - the string will be in the form 2001/05/01
Returns:
a string as requested by date_format
bool xsystem::DeleteFile ( LPCTSTR  lpFileName  ) 

Deletes an existing file. If the function succeeds,the return value is true. To get extended error information,call xsystem::ViewLastError method.

bool xsystem::DeleteFolder ( LPCTSTR  folder_name,
LPCTSTR  seed = _T("*.*"),
bool  recursive = true,
bool  delete_folder = true 
)

Deletes files for a specified seed(i.e. *.txt) for a specified folder. If the function succeeds,the return value is true. If recursive is true,sub-folders will be scanned. If delete_folder is true,the folder will be deleted. If delete_folder is true,recursive is overrided(will be always true).

void xsystem::FatalMessage ( LPCTSTR  message  )  [inline]

A Message method with predefined title and push buttons for a fatal message

bool xsystem::FileAttributes ( LPCTSTR  lpFileName,
unsigned long  dwFileAttributes 
)

Sets a file's attributes. If the function succeeds,the return value is true. To get extended error information,call xsystem::ViewLastError method.

Parameters:
lpFileName - Pointer to a string that specifies the name of the file whose attributes are to be set.
dwFileAttributes - Specifies the file attributes to set for the file. This parameter can be a combination of the following values. However,all other values override FILE_ATTRIBUTE_NORMAL.

  • FILE_ATTRIBUTE_ARCHIVE - The file is an archive file. Applications use this attribute to mark files for backup or removal.
  • FILE_ATTRIBUTE_HIDDEN - The file is hidden. It is not included in an ordinary directory listing.
  • FILE_ATTRIBUTE_NORMAL - The file has no other attributes set. This attribute is valid only if used alone.
  • FILE_ATTRIBUTE_OFFLINE - The data of the file is not immediately available. Indicates that the file data has been physically moved to offline storage.
  • FILE_ATTRIBUTE_READONLY - The file is read-only. Applications can read the file but cannot write to it or delete it.
  • FILE_ATTRIBUTE_SYSTEM - The file is part of the operating system or is used exclusively by it.
  • FILE_ATTRIBUTE_TEMPORARY - The file is being used for temporary storage. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.
bool xsystem::isCommonControls_40 ( void   )  [inline]
Returns:
true if COMCTRL32 version is 4.0 or later
bool xsystem::isCommonControls_IE470 ( void   )  [inline]
Returns:
true if COMCTRL32 version is 4.70 or later
bool xsystem::isCommonControls_IE471 ( void   )  [inline]
Returns:
true if COMCTRL32 version is 4.71 or later
bool xsystem::isCommonControls_IE472 ( void   )  [inline]
Returns:
true if COMCTRL32 version is 4.72 or later
bool xsystem::isNT ( void   )  [inline]
Returns:
true if the operating system platform is NT
bool xsystem::isServer2003 ( void   )  [inline]
Returns:
true if the operating system platform is WIN SERVER 2003
bool xsystem::isServer2003R2 ( void   )  [inline]
Returns:
true if the operating system platform is WIN SERVER 2003 R2
bool xsystem::isServer2008 ( void   )  [inline]
Returns:
true if the operating system platform is WINDOWS SERVER 2008 R2
bool xsystem::isServer2008R2 ( void   )  [inline]
Returns:
true if the operating system platform is WINDOWS SERVER 2008 R2
bool xsystem::isWindows2000 ( void   )  [inline]
Returns:
true if the operating system platform is WIN2000
bool xsystem::isWindows7 ( void   )  [inline]
Returns:
true if the operating system platform is WINDOWS 7
bool xsystem::isWindows95 ( void   )  [inline]
Returns:
true if the operating system platform is WIN)%
bool xsystem::isWindows98 ( void   )  [inline]
Returns:
true if the operating system platform is WIN98
bool xsystem::isWindowsME ( void   )  [inline]
Returns:
true if the operating system platform is WINME
bool xsystem::isWindowsVista ( void   )  [inline]
Returns:
true if the operating system platform is WIN VISTA
bool xsystem::isWindowsXP ( void   )  [inline]
Returns:
true if the operating system platform is XP
bool xsystem::LockWindow ( HWND  window_handle  )  [inline]

Disables drawing in the specified window. Only one window can be locked at a time.

int xsystem::Message ( LPCTSTR  message = _T("?"),
LPCTSTR  title = _T("Message"),
int  style = MB_ICONINFORMATION 
)

Creates,displays,and operates a message box. The message box contains an application-defined message and title,plus any combination of predefined icons and push buttons.

Parameters:
message -
title -
style - Specifies the message type. This parameter can be one of the following values:

  • MB_ABORTRETRYIGNORE - The message box contains three pushbuttons: Abort,Retry,and Ignore.
  • MB_OK - The message box contains one pushbutton: OK.
  • MB_OKCANCEL - The message box contains two pushbuttons: OK and Cancel.
  • MB_RETRYCANCEL - The message box contains two pushbuttons: Retry and Cancel.
  • MB_YESNO - The message box contains two pushbuttons: Yes and No.
  • MB_YESNOCANCEL - The message box contains three pushbuttons: Yes,No,and Cancel.
  • MB_APPLMODAL - The user must respond to the message box before continuing work in the current window. However,the user can move to the windows of other applications and work in those windows. The default is MB_APPLMODAL if neither MB_SYSTEMMODAL nor MB_TASKMODAL is specified.
  • MB_SYSTEMMODAL - All applications are suspended until the user responds to the message box. System-modal message boxes are used to notify the user of serious,potentially damaging errors that require immediate attention and should be used sparingly.
  • MB_TASKMODAL - Similar to MB_APPLMODAL,but not useful within a Microsoft Foundation class application. This flag is reserved for a calling application or library that does not have a window handle available.
  • MB_ICONEXCLAMATION - An exclamation-point icon appears in the message box.
  • MB_ICONINFORMATION - An icon consisting of an “i” in a circle appears in the message box.
  • MB_ICONQUESTION - A question-mark icon appears in the message box.
  • MB_ICONSTOP - A stop-sign icon appears in the message box.
  • MB_DEFBUTTON1 - The first button is the default. Note that the first button is always the default unless MB_DEFBUTTON2 or MB_DEFBUTTON3 is specified.
  • MB_DEFBUTTON2 - The second button is the default.
  • MB_DEFBUTTON3 - The third button is the default. The return value is zero if there is not enough memory to create the message box. The return value is one of the following menu-item values returned by the dialog box:
  • IDABORT - Abort button was selected.
  • IDCANCEL - Cancel button was selected.
  • IDIGNORE - Ignore button was selected.
  • IDNO - No button was selected.
  • IDOK - OK button was selected.
  • IDRETRY - Retry button was selected.
  • IDYES - Yes button was selected. If a message box has a Cancel button,the function returns the IDCANCEL value if either the esc key is pressed or the Cancel button is selected. If the message box has no Cancel button,pressing esc has no effect.
bool xsystem::MoveFile ( LPCTSTR  source,
LPCTSTR  destination 
)

Deletes an existing file. If the function succeeds,the return value is true. To get extended error information,call xsystem::ViewLastError method.

unsigned long xsystem::OSPlatform ( void   )  [inline]
Returns:
the operating system platform. The return value can be one of the following values:
  • VER_PLATFORM_WIN32s - Win32s on Windows 3.1.
  • VER_PLATFORM_WIN32_WINDOWS - Win32 on Windows 95 or Windows 98. For Windows 95,dwMinorVersion is zero. For Windows 98,dwMinorVersion is greater than zero.
  • VER_PLATFORM_WIN32_NT - Win32 on Windows NT.
unsigned long xsystem::OSVersionBuild ( void   )  [inline]
Returns:
the build number of the operating system
unsigned long xsystem::OSVersionMajor ( void   )  [inline]
Returns:
the major version number of the operating system
unsigned long xsystem::OSVersionMinor ( void   )  [inline]
Returns:
the minor version number of the operating system
xstring xsystem::ReadProfile ( LPCTSTR  lpAppName,
LPCTSTR  lpKeyName,
LPCTSTR  lpDefault,
LPCTSTR  lpFileName 
) [inline]

Retrieves a string from the specified section in an initialization file.

Parameters:
lpAppName - Pointer to a null-terminated string that specifies the section containing the key name. If this parameter is NULL,copies all section names.
lpKeyName - Pointer to the null-terminated string containing the key name whose associated string is to be retrieved. If this parameter is NULL,all key names in the section specified by the lpAppName parameter are copied.
lpDefault - Pointer to a null-terminated default string. Avoid specifying a default string with trailing blank characters.
lpFileName -Pointer to a null-terminated string that names the initialization file. If this parameter does not contain a full path to the file,the system searches for the file in the Windows directory.
bool xsystem::RemoveFolder ( LPCTSTR  folder_name  ) 

Deletes an existing empty directory. If the function succeeds,the return value is true. To get extended error information,call xsystem::ViewLastError method.

bool xsystem::RenamePath ( LPCTSTR  oldname,
LPCTSTR  newname 
) [inline]

Renames a file or directory.

Parameters:
oldname - old name
newname - new name The rename function renames the file or directory specified by oldname to the name given by newname. The old name must be the path of an existing file or directory. The new name must not be the name of an existing file or directory. You can use rename to move a file from one directory or device to another by giving a different path in the newname argument. However,you cannot use rename to move a directory. Directories can be renamed,but not moved.
Returns:
0 if it is successful.
xstring xsystem::TempFile ( LPCTSTR  folder,
LPCTSTR  prefix 
) [inline]

Creates a unique file name and creates the file in the specified directory. The file name is the concatenation of specified path and prefix strings,a hexadecimal string formed from a specified integer,and the .tmp extension.

Parameters:
folder - Specifies the directory path for the file name. This string must consist of characters in the ANSI character set. Applications typically specify a period (.) or the result of the GetTempPath function for this parameter. If this parameter is NULL,the function fails.
prefix - The function uses the first three characters of this string as the prefix of the file name. This string must consist of characters in the ANSI character set.
xstring xsystem::Time ( TCHAR  time_format = HHsMMsSS  ) 

Gets the current system time

Parameters:
time_format - This parameter can be one of the following values: (i.e. the current system time is ten paste nine o' clock)

  • HHMMSS - the string will be in the form 091001
  • HHMMSSmmm - the string will be in the form 091001001
  • HHsMMsSS - the string will be in the form 09:10:01
  • HHsMMsSSsmmm - the string will be in the form 09:10:01:001
Returns:
a string as requested by time_format
bool xsystem::UnlockWindow ( void   )  [inline]

Reenables drawing in the specified window. Only one window can be locked at a time.

void xsystem::ViewLastError ( LPCTSTR  remark,
unsigned long  error 
)

Visualize extended error information.

void xsystem::WarningMessage ( LPCTSTR  message  )  [inline]

A Message method with predefined title and push buttons for a warning message

int xsystem::WarningMessageNoYes ( LPCTSTR  message,
LPCTSTR  title = _T ( "Warning" ) 
) [inline]

A Message method with predefined title and push buttons for a warning message

int xsystem::WarningMessageYesNo ( LPCTSTR  message,
LPCTSTR  title = _T ( "Warning" ) 
) [inline]

A Message method with predefined title and push buttons for a warning message

int xsystem::WarningMessageYesNoCancel ( LPCTSTR  message,
LPCTSTR  title = _T ( "Warning" ) 
) [inline]

A Message method with predefined title and push buttons for a warning message

int xsystem::WaveInputDevicesCount ( void   )  [inline]
Returns:
the number of waveform-audio input devices present in the system.
int xsystem::WaveOutputDevicesCount ( void   )  [inline]
Returns:
the number of waveform-audio output devices present in the system.
void xsystem::WriteProfile ( LPCTSTR  lpAppName,
LPCTSTR  lpKeyName,
LPCTSTR  lpString,
LPCTSTR  lpFileName 
) [inline]

Copies a string into the specified section of the specified initialization file.

Parameters:
lpAppName - Pointer to a null-terminated string containing the name of the section to which the string will be copied. If the section does not exist,it is created. The name of the section is case-independent; the string can be any combination of uppercase and lowercase letters.
lpKeyName - Pointer to the null-terminated string containing the name of the key to be associated with a string. If the key does not exist in the specified section,it is created. If this parameter is NULL,the entire section,including all entries within the section,is deleted.
lpString - Pointer to a null-terminated string to be written to the file. If this parameter is NULL,the key pointed to by the lpKeyName parameter is deleted.
lpFileName - Pointer to a null-terminated string that names the initialization file.

Member Data Documentation

unsigned long xsystem::error_code

A per-thread value set by Win32 functions when an error occurs. Use xsystem::ViewLastError method with this error-code to obtain a message box with the description string.

In case of errors, the function members will show a message box with detailed information. This member may be one of following values:

  • __talk - show details.
  • __silent - don't show details.

The documentation for this class was generated from the following file:

Generated on Sun Nov 29 07:22:16 2009 for Rad.on++ by  doxygen 1.6.1