This code finds the processor model, and speed.
VB Code:
Option Explicit Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal Hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal Hkey As Long) As Long Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal Hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long Private Const REG_SZ = 1 Private Const REG_DWORD = 4 Private Const HKLM = &H80000002 Private Sub Main() Dim Hkey As Long, Speed As Long, Model As String, StrBuff As Long Call RegOpenKey(HKLM, "Hardware\Description\System\CentralProcessor\0", Hkey&) Call RegQueryValueEx(Hkey&, "~Mhz", 0&, REG_DWORD, Speed&, 4&) Call RegQueryValueEx(Hkey&, "ProcessorNameString", 0&, REG_SZ, ByVal 0&, StrBuff&) Model$ = Space$(StrBuff&) Call RegQueryValueEx(Hkey&, "ProcessorNameString", 0&, REG_SZ, ByVal Model$, Len(Model$)) Model$ = Replace$(Model$, "(tm)", vbNullString) Model$ = Replace$(Model$, Chr$(0), vbNullString) MsgBox "Processor Model: " & Model$ & vbCrLf _ & "Speed: " & Speed& & "MHz", vbOKOnly, "Processor Info - Coded by Dean" Call RegCloseKey(Hkey) End Sub
-Sir Loin




Reply With Quote