home *** CD-ROM | disk | FTP | other *** search
- // BDE - (C) Copyright 1995 by Borland International
-
- // SysInfo.c
- #include "snipit.h"
-
- //=====================================================================
- // Function:
- // SysInfo();
- //
- // Description:
- // This example displays information about the system.
- //=====================================================================
- void
- SysInfo (void)
- {
- DBIResult rslt; // Value returned from IDAPI functions
- SYSVersion sysVersion; // Version information
- SYSConfig sysConfig; // Configuration information
- CLIENTInfo clientInfo; // Client information
- SYSInfo sysInfo; // System information
-
- CHAR szDate[12]; // String to hold the date
- UINT16 uMonth; // Month of the year
- UINT16 uDay; // Day of the month
- INT16 iYear; // Year
-
- CHAR szTime[12]; // String to contain the time
- UINT16 uHour; // Hour
- UINT16 uMin; // Minute
- UINT16 uMilSec; // Millisecond
-
- Screen("*** Getting system information ***\r\n");
-
- BREAK_IN_DEBUGGER();
-
- Screen("\r\n Initializing IDAPI...");
- rslt = DbiInit(NULL);
- if (ChkRslt(rslt, "Init") != DBIERR_NONE)
- {
- Screen("\r\n*** End of Example ***");
- return;
- }
-
- // Turn on trace information if the debug layer is anabled (DLLSWAP.EXE).
- DbiDebugLayerOptions(DEBUGON | OUTPUTTOFILE, "SNIPIT.INF");
-
- // Specify where temporary files are placed.
- rslt = DbiSetPrivateDir(szPrivDirectory);
- ChkRslt(rslt, "SetPrivateDir");
-
- Screen("\r\n Getting system version info...");
- rslt = DbiGetSysVersion(&sysVersion);
- ChkRslt(rslt, "GetSysVersion");
-
- // Format the date to MM\DD\YYYY format.
- rslt = DbiDateDecode(sysVersion.dateVer, &uMonth, &uDay, &iYear);
- ChkRslt(rslt, "DateEncode");
- wsprintf(szDate, "%u\\%u\\%u", uMonth, uDay, iYear);
-
- // Format the time to HH:MM:SS format.
- rslt = DbiTimeDecode(sysVersion.timeVer, &uHour, &uMin, &uMilSec);
- ChkRslt(rslt, "TimeEncode");
- wsprintf(szTime, "%02u:%02u:%02u", uHour, uMin, (uMilSec / 1000));
-
- // Display the version information.
- Screen(" IDAPI Version: %d", sysVersion.iVersion);
- Screen(" Interface Level: %d", sysVersion.iIntfLevel);
- Screen(" Version Date: %s", szDate);
- Screen(" Version Time: %s", szTime);
-
- Screen("\r\n Getting system configuration information...");
- rslt = DbiGetSysConfig(&sysConfig);
- ChkRslt(rslt, "GetSysConfig");
-
- // Display configuration information.
- Screen(" Share Local Tables : %s",
- (sysConfig.bLocalShare ? "TRUE" : "FALSE"));
- Screen(" Share Network Tables: %s",
- (sysConfig.bNetShare ? "TRUE" : "FALSE"));
- Screen(" Net Protocol: %d", sysConfig.iNetProtocol);
- Screen(" Network Type: %s", sysConfig.szNetType);
- Screen(" User Name: %s", sysConfig.szUserName);
- Screen(" Config File: %s", sysConfig.szIniFile);
- Screen(" Language Driver: %s", sysConfig.szLangDriver);
-
- Screen("\r\n Getting Client Information...");
- rslt = DbiGetClientInfo(&clientInfo);
- ChkRslt(rslt, "GetClientInfo");
-
- // Display client information.
- Screen(" Documentary name: %s",
- clientInfo.szName);
- Screen(" Number of sessions: %d",
- clientInfo.iSessions);
- Screen(" Working directory: %s",
- clientInfo.szWorkDir);
- Screen(" Client language(for messages): %s",
- clientInfo.szLang);
-
- Screen("\r\n Getting system status information...");
- rslt = DbiGetSysInfo(&sysInfo);
- ChkRslt(rslt, "GetSysInfo");
-
- // Display system status information.
- Screen(" %dK Buffer Space %dK Heap Space",
- sysInfo.iBufferSpace, sysInfo.iHeapSpace);
- Screen(" Active: %d driver(s), %d client(s), %d session(s)",
- sysInfo.iDrivers, sysInfo.iClients, sysInfo.iSessions);
- Screen(" Open : %d Database(s), %d Cursor(s)",
- sysInfo.iDatabases, sysInfo.iCursors);
-
- // Turn off trace information.
- DbiDebugLayerOptions(0, NULL);
-
- // Exit IDAPI.
- rslt = DbiExit();
- ChkRslt(rslt, "Exit");
-
- Screen("\r\n*** End of example ***");
- }
-