PC識別情報の取得2007年02月16日 18時39分13秒

プロダクトID(ProductId) HKEY_LOCAL_MACHINE|Software\Microsoft\Windows\CurrentVersion

にある。XP、2000でも同じだった。

WMIを使用するとVBAで簡単に取得できた。 Dim Reg As SWbemObject Dim Locator As SWbemLocator Dim Service As SWbemServices Dim sRet As String Dim TmpbRet As String Dim I As Long

Set Locator = New WbemScripting.SWbemLocator Set Service = Locator.ConnectServer(vbNullString, "root\default") Set Reg = Service.Get("StdRegProv")

Const HKEY_LOCAL_MACHINE = &H80000002

'文字列値 Reg.GetStringValue HKEY_LOCAL_MACHINE,   "Software\Microsoft\Windows\CurrentVersion", "ProductId", sRet

MsgBox sRet

Set Reg = Nothing Set Service = Nothing Set Locator = Nothing