Red de conocimiento informático - Problemas con los teléfonos móviles - ¿Cómo obtiene VC la identificación del hardware, la CPU, el hardware, la tarjeta de red y otra información?

¿Cómo obtiene VC la identificación del hardware, la CPU, el hardware, la tarjeta de red y otra información?

Esto tiene una API correspondiente u otro nivel de encapsulación de interfaz. Principiantes, lean MSDN detenidamente para comprender los conocimientos básicos --------------------------, déjenme darles un ejemplo.

Definición:

CString DetectCPUType();

CString DetectMemoryType()

Variable:

// Tipo de CPU

CString m_sCPUNameString

CString m_sCPUIdentifier

CString m_sCPUVendorIdentifier

DWORD m_dwCPUSpeed ​​

// en MB Memoria física total;

DWORD m_TotMem

// Memoria virtual total

DWORD m_TotVirtMem

Función:

CString CSystemLocalInfo; ::DetectCPUType()

{

LONG lresultado;

HKEY NewKey

lresultado = RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T (CPU_CONFIGURATION_KEY) ,

0,KEY_EXECUTE, & amp;NewKey);

if (ERROR_SUCCESS != lresult) return 0 // clave no encontrada

TCHAR szKeyValue[ 100]; memset(szKeyValue,0,100);

DWORD dwType=REG_SZ; DWORD dwSize=100;

lresult=RegQueryValueEx(NewKey,_T("Identificador"), NULL,

p >

&dwType,(LPBYTE)szKeyValue,&dwSize);

if ((lresult== ERROR_SUCCESS) && (dwSize> 0)))

{ m_sCPUIdentifier=szKeyValue } ;

memset(szKeyValue,0,100); dwType=REG_SZ; dwSize= 100;

lresult=RegQueryValueEx(NewKey,_T("VendorIdentifier"), NULL,

&dwType,(LPBYTE)szKeyValue,&dwSize);

if ((lresult==ERROR_SUCCESS) && (dwSize>0)))

{ m_sCPUVendorIdentifier=szKeyValue }

memset(szKeyValue,0,100); dwType=REG_SZ; dwSize=100

lresult=RegQueryValueEx(NewKey,_T("ProcessorNameString"),

NULL,&dwType,(LPBYTE) szKeyValue,&dwSize);

if ((lresult==ERROR_SUCCESS) && (dwSize>0))

{

m_sCPUNameString=szKeyValue;

DWORD dwData=0; dwType=REG_DWORD; dwSize=sizeof(dwData) lresult=RegQueryValueEx(NewKey,_T("~MHz"), NULL,

&dwType,( LPBYTE)(&dwData),&dwSize

if ((lresult==ERROR_SUCCESS) && (dwSize>0))

{ m_dwCPUSpeed=dwData;

RegCloseKey(NewKey);

Devuelve szKeyValue

}

CString CSystemLocalInfo::DetectMemoryType( )

{

// TODO: Agregar inicialización adicional aquí

MEMORYSTATUS Mem

// obtener el estado de la memoria

GlobalMemoryStatus(&Mem);

// establece la memoria total

this->m_TotMem=(DWORD)Mem.dwTotalPhys/(1024*1024); >

this->m_TotVirtMem=(DWORD)Mem.dwTotalVirtual/(1024* 1024);

CString Msg

Msg.Format("Memoria física: %ld MB; : Memoria virtual: %ld MB",

this->m_TotMem,this->m_TotVirtMem);

devolver mensaje;

}