CPUのクロック数を取得(Win2K用)
レジストリにかかれている情報を読み込めばいいだけ。
ただし、Windows2000の場合。(NT4は不明)


Option Explicit

Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" ( _
    ByVal hKey As Long, _
    ByVal lpSubKey As String, _
    ByVal ulOptions As Long, _
    ByVal samDesired As Long, _
    phkResult 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 Declare Function RegCloseKey Lib "advapi32.dll" ( _
    ByVal hKey As Long _
) As Long

Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const KEY_QUERY_VALUE = &H1
Private Const ERROR_SUCCESS = 0&

Private Sub cmdExit_Click()
    End
End Sub

Private Sub cmdRun_Click()
    Dim hKey As Long
    Dim nRet As Long
    Dim nData As Long
    Dim nSize As Long
    Dim nCnt As Long
    
    txtOutput.Text = ""
    nCnt = 0
    Do
        nRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Hardware\Description\System\CentralProcessor\" & nCnt, _
                            0, KEY_QUERY_VALUE, hKey)
        If nRet <> ERROR_SUCCESS Then
            Exit Do
        End If
        
        nSize = 4
        nRet = RegQueryValueEx(hKey, "~MHz", 0, 0, nData, nSize)
    
        txtOutput.Text = txtOutput.Text & "CPU " & nCnt & ":" & nData & "MHz" & vbCrLf
        Call RegCloseKey(hKey)
        nCnt = nCnt + 1
    Loop
End Sub