{ SysInfo.pas } program SystemInfo; {$IfDef VER80} uses SnipTool, SnipData, SysUtils, WinTypes, WinProcs, DbiProcs, DbiTypes, DbiErrs; {$Else} uses WinTypes, WinProcs, WinCrt, Strings, DbiProcs, DbiTypes, DbiErrs, SnipTool, SnipData; {$EndIf} {===================================================================== Function: SysInfo(); Description: This example displays information about the system. ===================================================================== } var rslt: DBIResult; { Value returned from IDAPI functions } sysVers: SYSVersion; { Version information } sysConf: SYSConfig; { Configuration information } clientInf: CLIENTInfo; { Client information } sysInf: SYSInfo; { System information } szDate: array[0..12] of CHAR; { String to hold the date } ArgDate: array[0..2] of UINT16; uMonth: UINT16; { Month of the year } uDay: UINT16; { Day of the month } iYear: INT16; { Year } szTime: array[0..12] of CHAR; { String to contain the time } ArgTime: array[0..2] of UINT16; uHour: UINT16; { Hour } uMin: UINT16; { Minute } uMilSec: UINT16; { Millisecond } szTrueFalse: array[0..6] of CHAR; begin Screen('*** Getting System Information ***'); Screen(' Initializing IDAPI...'); InitOutput; rslt := ChkRslt(DbiInit(nil), DBIERR_NONE, ' Error - Init'); if (rslt <> DBIERR_NONE) then begin Screen(''); Screen('*** End of Example ***'); CloseOutput; exit; end; Screen(''); Screen(' Getting System Version Info...'); ChkRslt(DbiGetSysVersion(sysVers), DBIERR_NONE, ' Error - GetSysVersion.'); { Format the date to MM\DD\YYYY format } ChkRslt(DbiDateDecode(sysVers.dateVer, uMonth, uDay, iYear),DBIERR_NONE, ' Error - DateEncode.'); ArgDate[0] := uMonth; ArgDate[1] := uDay; ArgDate[2] := iYear; wvsprintf(szDate, '%u\%u\%u', ArgDate); { Format the time to HH:MM:SS format } ChkRslt(DbiTimeDecode(sysVers.timeVer, uHour, uMin, uMilSec),DBIERR_NONE, ' Error - TimeEncode.'); ArgTime[0] := uHour; ArgTime[1] := uMin; ArgTime[2] := trunc(uMilSec / 1000); wvsprintf(szTime, '%02u:%02u:%02u', ArgTime); { Display the version information } Screen(' IDAPI Version: '+IntToStr(sysVers.iVersion)+' '); Screen(' Interface Level: '+IntToStr(sysVers.iIntfLevel)+' '); Screen(' Version Date: '+StrPas(szDate)+' '); Screen(' Version Time: '+StrPas(szTime)+' '); Screen(''); Screen(' Getting System Configuration Information...'); ChkRslt(DbiGetSysConfig(sysConf), DBIERR_NONE, ' Error - GetSysConfig.'); { Display configuration information } if sysConf.bLocalShare then StrCopy(szTrueFalse,'TRUE') else StrCopy(szTrueFalse,'FALSE'); Screen(' Share Local Tables : '+StrPas(szTrueFalse)+' '); if sysConf.bNetShare then StrCopy(szTrueFalse,'TRUE') else StrCopy(szTrueFalse,'FALSE'); Screen(' Share Network Tables: '+StrPas(szTrueFalse)+' '); Screen(' Net Protocol: '+IntToStr(sysConf.iNetProtocol)+' '); Screen(' Network Type: '+ ' '+StrPas(sysConf.szNetType)+' '); Screen(' User Name: '+ ' '+StrPas(sysConf.szUserName)+' '); Screen(' Config File: '+ ' '+StrPas(sysConf.szIniFile)+' '); Screen(' Lang. Driver: '+ ' '+StrPas(sysConf.szLangDriver)+' '); Screen(''); Screen(' Getting Client Information...'); ChkRslt(DbiGetClientInfo(clientInf), DBIERR_NONE, ' Error - GetClientInfo.'); { Display Client information } Screen(' Documentary Name: '+ ' '+StrPas(clientInf.szName)+' '); Screen(' No. of Sessions: '+ ' '+IntToStr(clientInf.iSessions)+' '); Screen(' Working Directory: '+ ' '+StrPas(clientInf.szWorkDir)+' '); Screen(' Client Language(for messages): '+ ' '+StrPas(clientInf.szLang)+' '); Screen(''); Screen(' Getting System Status Information...'); ChkRslt(DbiGetSysInfo(SysInf), DBIERR_NONE, ' Error - GetSysInfo.'); { Display system status information } Screen(' '+IntToStr(sysInf.iBufferSpace)+'K Buffer Space '+ IntToStr(sysInf.iHeapSpace)+'K Heap Space'); Screen(' Active: '+IntToStr(sysInf.iDrivers)+' driver(s) '+ IntToStr(sysInf.iClients)+' client(s) '+ IntToStr(sysInf.iSessions)+ ' session(s)'); Screen(' Open : '+IntToStr(sysInf.iDatabases)+ ' Database(s) '+IntToStr(sysInf.iCursors)+' Cursor(s)'); { Exit IDAPI } DbiExit; Screen(''); CloseOutput; Screen('*** End of example ***'); end.