home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1998 November
/
VPR9811A.BIN
/
VPR_DATA
/
Program
/
Ce
/
System.c
< prev
Wrap
C/C++ Source or Header
|
1998-09-04
|
3KB
|
98 lines
//
// System.c
//
#include <windows.h>
#include "resource.h"
//----------------------------------------------------------------------------
BOOL DisplaySystemInfo(
HWND hWnd,
PAINTSTRUCT * ps)
//----------------------------------------------------------------------------
{
OSVERSIONINFO VersionInformation;
SYSTEM_INFO SystemInfo;
MEMORYSTATUS msStatus;
RECT rc;
TCHAR szWork[80];
INT i;
TCHAR szUnknown[] = TEXT("不明");
const LPCTSTR pszProcessorType[4] = {
TEXT("MIPS R3000"),TEXT("MIPS R4000"),TEXT("Hitachi SH3"),szUnknown
};
rc.top = 30;
rc.bottom = rc.top + 14;
rc.left = 0;
rc.right = 200;
// change UNICODE char
mbstowcs(szWork, "Microsoftョ WindowsョCE", 22);
DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
rc.top += 15;
rc.bottom = rc.top + 14;
VersionInformation.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&VersionInformation);
wsprintf(szWork, TEXT("Version\t: %d.%02d"),
VersionInformation.dwMajorVersion,
VersionInformation.dwMinorVersion);
DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
rc.top += 15;
rc.bottom = rc.top + 14;
// Get system default language.
wcscpy(szWork, TEXT("言語の種類\t: 日本語"));
if((GetSystemDefaultLangID() & 0xff) != LANG_JAPANESE)
wcscat(szWork, TEXT("以外"));
DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
// Get information about the current system.
GetSystemInfo(&SystemInfo);
rc.top += 30;
rc.bottom = rc.top + 14;
// is the machine connected to the mains?
switch (SystemInfo.dwProcessorType)
{
case PROCESSOR_MIPS_R3000:
i = 0;
break;
case PROCESSOR_MIPS_R4000:
i = 1;
break;
case PROCESSOR_HITACHI_SH3:
i = 2;
break;
default:
i = 3;
}
wsprintf(szWork, TEXT("CPUの種類\t: %s"), pszProcessorType[i]);
DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
// Get global memory status
msStatus.dwLength = sizeof(MEMORYSTATUS);
rc.top += 15;
rc.bottom = rc.top + 14;
GlobalMemoryStatus(&msStatus);
DrawText(ps->hdc, TEXT("《プログラム メモリ》"), -1, &rc, DT_LEFT | DT_EXPANDTABS);
rc.top += 15;
rc.bottom = rc.top + 14;
wsprintf(szWork, TEXT("使用比率\t: %d%%"), msStatus.dwMemoryLoad);
DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
rc.top += 15;
rc.bottom = rc.top + 14;
wsprintf(szWork, TEXT("有効領域\t: %u KB"), msStatus.dwTotalPhys / 1024);
DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
rc.top += 15;
rc.bottom = rc.top + 14;
wsprintf(szWork, TEXT("未使用領域\t: %u KB"), msStatus.dwAvailPhys / 1024);
DrawText(ps->hdc, szWork, -1, &rc, DT_LEFT | DT_EXPANDTABS);
return TRUE;
}