home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1998 November / VPR9811A.BIN / VPR_DATA / Program / Ce / System.c < prev   
C/C++ Source or Header  |  1998-09-04  |  3KB  |  98 lines

  1. //
  2. //    System.c
  3. //
  4. #include    <windows.h>
  5. #include    "resource.h"
  6.  
  7. //----------------------------------------------------------------------------
  8. BOOL DisplaySystemInfo(
  9.         HWND    hWnd,
  10.         PAINTSTRUCT * ps)
  11. //----------------------------------------------------------------------------
  12. {
  13.     OSVERSIONINFO    VersionInformation;
  14.     SYSTEM_INFO        SystemInfo;
  15.     MEMORYSTATUS    msStatus;
  16.     RECT    rc;
  17.     TCHAR    szWork[80];
  18.     INT        i;
  19.     TCHAR    szUnknown[] = TEXT("不明");
  20.     const LPCTSTR    pszProcessorType[4] = {
  21.         TEXT("MIPS R3000"),TEXT("MIPS R4000"),TEXT("Hitachi SH3"),szUnknown
  22.     };
  23.  
  24.     rc.top    = 30;
  25.     rc.bottom = rc.top + 14;
  26.     rc.left   = 0;
  27.     rc.right  = 200;
  28.  
  29.     // change UNICODE char
  30.     mbstowcs(szWork, "Microsoftョ WindowsョCE", 22);
  31.     DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
  32.  
  33.     rc.top += 15;
  34.     rc.bottom = rc.top + 14;
  35.     VersionInformation.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  36.     GetVersionEx(&VersionInformation); 
  37.     wsprintf(szWork, TEXT("Version\t: %d.%02d"),
  38.         VersionInformation.dwMajorVersion,
  39.         VersionInformation.dwMinorVersion);
  40.     DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
  41.  
  42.     rc.top += 15;
  43.     rc.bottom = rc.top + 14;
  44.     // Get system default language.
  45.     wcscpy(szWork, TEXT("言語の種類\t: 日本語"));
  46.     if((GetSystemDefaultLangID() & 0xff) != LANG_JAPANESE)
  47.         wcscat(szWork, TEXT("以外"));
  48.     DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
  49.  
  50.     // Get information about the current system.
  51.     GetSystemInfo(&SystemInfo); 
  52.  
  53.     rc.top += 30;
  54.     rc.bottom = rc.top + 14;
  55.     // is the machine connected to the mains?
  56.     switch (SystemInfo.dwProcessorType)
  57.     {
  58.         case PROCESSOR_MIPS_R3000:
  59.             i = 0;
  60.             break;
  61.         case PROCESSOR_MIPS_R4000:
  62.             i = 1;
  63.             break;
  64.         case PROCESSOR_HITACHI_SH3:
  65.             i = 2;
  66.             break;
  67.         default:
  68.             i = 3;
  69.     }
  70.     wsprintf(szWork, TEXT("CPUの種類\t: %s"), pszProcessorType[i]);
  71.     DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
  72.  
  73.     // Get global memory status
  74.     msStatus.dwLength = sizeof(MEMORYSTATUS);
  75.  
  76.     rc.top += 15;
  77.     rc.bottom = rc.top + 14;
  78.     GlobalMemoryStatus(&msStatus);
  79.     DrawText(ps->hdc, TEXT("《プログラム メモリ》"), -1, &rc, DT_LEFT | DT_EXPANDTABS);
  80.  
  81.     rc.top += 15;
  82.     rc.bottom = rc.top + 14;
  83.     wsprintf(szWork, TEXT("使用比率\t: %d%%"), msStatus.dwMemoryLoad);
  84.     DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
  85.  
  86.     rc.top += 15;
  87.     rc.bottom = rc.top + 14;
  88.     wsprintf(szWork, TEXT("有効領域\t: %u KB"), msStatus.dwTotalPhys / 1024);
  89.     DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
  90.  
  91.     rc.top += 15;
  92.     rc.bottom = rc.top + 14;
  93.     wsprintf(szWork, TEXT("未使用領域\t: %u KB"), msStatus.dwAvailPhys / 1024);
  94.     DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
  95.  
  96.     return TRUE;
  97. }
  98.