Private Declare Function GetCPUCount Lib "cpu.dll" () As Long
Private Declare Function GetCPUFrequency Lib "cpu.dll" () As Long
Private Declare Sub GetCPUString Lib "cpu.dll" (ByRef ch17rtn As Byte)
Private Declare Sub GetCPUStdVendor Lib "cpu.dll" (ByRef ch48rtn As Byte)
Public Function GetCPUFullDescription() As String
On Error GoTo ErrProc:
Dim strCPUString As String
Dim strCPUStdVendor As String
Dim ch17rtn(17) As Byte
Dim ch48rtn(48) As Byte
Dim i As Long
GetCPUStdVendor ch17rtn(0)
GetCPUString ch48rtn(0)
For i = 0 To 17
strCPUStdVendor = strCPUStdVendor & Chr(ch17rtn(i))
Next
For i = 0 To 48
strCPUString = strCPUString & Chr(ch48rtn(i))
Next
strCPUStdVendor = Trim(Replace(strCPUStdVendor, Chr(0), " "))
strCPUString = Trim(Replace(strCPUString, Chr(0), " "))
If Len(strCPUString) < 10 Then
strCPUString = strCPUStdVendor & " CPU"
End If
GetCPUFullDescription = GetCPUCount & " * " & strCPUString & " @ " & GetCPUFrequency & " MHz"
Exit Function
ErrProc:
Debug.Print Err.Description
End Function
Public Function GetShortCPUName() As String
On Error GoTo ErrProc:
Dim strCPUString As String
Dim strCPUStdVendor As String
Dim ch17rtn(17) As Byte
Dim ch48rtn(48) As Byte
Dim i As Long
GetCPUStdVendor ch17rtn(0)
GetCPUString ch48rtn(0)
For i = 0 To 17
strCPUStdVendor = strCPUStdVendor & Chr(ch17rtn(i))
Next
For i = 0 To 48
strCPUString = strCPUString & Chr(ch48rtn(i))
Next
strCPUStdVendor = Trim(Replace(strCPUStdVendor, Chr(0), " "))
strCPUString = Trim(Replace(strCPUString, Chr(0), " "))
If Len(strCPUString) < 10 Then
strCPUString = strCPUStdVendor & " CPU"
End If
GetShortCPUName = strCPUString
Exit Function
ErrProc:
Debug.Print Err.Description
End Function
void __stdcall GetCPUString(char * szCPUName)
{
union {
char CPUNameString[48];
struct {
unsigned int dw02a;
unsigned int dw02b;
unsigned int dw02c;
unsigned int dw02d;
unsigned int dw03a;
unsigned int dw03b;
unsigned int dw03c;
unsigned int dw03d;
unsigned int dw04a;
unsigned int dw04b;
unsigned int dw04c;
unsigned int dw04d;
} dws;
} CPUNameData;