검색결과 리스트
글
[WinAPI] 컴퓨터 각종 부품 정보 알아내기
Programming/C/C++
2014. 6. 22. 13:18
// 컴퓨터 각종 부품 정보 알아내기 std::wstring GetProcessorName() { wchar_t Cpu_info[100]; HKEY hKey; int i = 0; long result = 0; DWORD c_size = sizeof(Cpu_info); //레지스트리를 조사하여 프로세서의 모델명을 얻어냅니다. RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Hardware\\Description\\System\\CentralProcessor\\0", 0, KEY_QUERY_VALUE, &hKey); RegQueryValueEx(hKey, L"ProcessorNameString", NULL, NULL, (LPBYTE)Cpu_info, &c_size); RegCloseKey(hKey); //GetSystemInfo 함수를 이용해 논리적 코어 개수를 얻어냅니다. wchar_t num[8]; SYSTEM_INFO systemInfo; GetSystemInfo(&systemInfo); swprintf(num, 8, L" * %d", systemInfo.dwNumberOfProcessors); wcscat_s(Cpu_info, 100, num); return Cpu_info; } std::wstring GetOSName() { wchar_t ProductName[100]; wchar_t CSDVersion[100]; std::wstring Os_info; HKEY hKey; int i = 0; DWORD c_size = 100; //레지스트리를 조사하여 운영체제 이름을 조사합니다. if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\", 0, KEY_QUERY_VALUE, &hKey) != ERROR_SUCCESS) { return L"Fail to Open OS_info"; } if(RegQueryValueEx(hKey, L"ProductName", NULL, NULL, (LPBYTE)ProductName, &c_size) != ERROR_SUCCESS) { return L"Fail to Load the ProductName"; } if(RegQueryValueEx(hKey, L"CSDVersion", NULL, NULL, (LPBYTE)CSDVersion, &c_size) != ERROR_SUCCESS) { RegCloseKey(hKey); return ProductName; } Os_info = ProductName; Os_info += L" "; Os_info += CSDVersion; RegCloseKey(hKey); return Os_info; } std::string GetMemoryInfo() { //GlobalMemoryStatusEX 함수를 이용해 물리적 메모리양을 조사합니다. MEMORYSTATUSEX ms; ms.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&ms); char mss[128]; sprintf_s(mss, 128, "%d MB", ms.ullTotalPhys / 1024 / 1024); return mss; } std::string GetGPUInfo(LPDIRECT3D9 d3d) { //IDirect3D9 인터페이스를 이용해 GPU모델명을 얻어냅니다. D3DADAPTER_IDENTIFIER9 id; d3d->GetAdapterIdentifier(D3DADAPTER_DEFAULT, 0, &id); return id.Description; }http://bab2min.tistory.com/358
'Programming > C/C++' 카테고리의 다른 글
Memory Bandwidth (0) | 2014.06.30 |
---|---|
비디오 메모리 구하기 (0) | 2014.06.24 |
GlobalMemoryStatusEx (0) | 2014.06.22 |
stack overrun (0) | 2014.06.19 |
operator new (0) | 2014.06.14 |