This site uses cookies own and third. If you continue to browse consider to accept the use of cookies. OK More Info.

Obtener Procesador [C/C++]

  • 0 Replies
  • 3295 Views

0 Members and 1 Guest are viewing this topic.

Offline Expermicid

  • *
  • Ex-Staff
  • *****
  • Posts: 458
  • Actividad:
    0%
  • Reputación 0
  • _-Expermicid-_
    • View Profile

Obtener Procesador [C/C++]

  • on: January 17, 2013, 01:47:04 pm
Pequeño code para obtener el procesador de la PC. :)

Code: (c) You are not allowed to view links. Register or Login
#include <Windows.h>
#include <iostream>

using namespace std;

void main() {
char *sTemp;
DWORD bytesread;
HKEY hkey;

if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 0, KEY_READ, &hkey) == ERROR_SUCCESS) {
        if (RegQueryValueEx(hkey, "ProcessorNameString", 0, 0, 0, &bytesread) == ERROR_SUCCESS) {
sTemp = (char *)malloc(bytesread);
if (RegQueryValueEx(hkey, "ProcessorNameString", 0, 0, (LPBYTE)sTemp, &bytesread) == ERROR_SUCCESS)
cout << "Procesador --> " << sTemp << endl;
free(sTemp);
}
RegCloseKey(hkey);
    }
getchar();
}

En funcionamiento:



Saludos