哈~~~~~~
Imports Microsoft.Win32'引用
'定义
Dim myDec As RegistryKey
Dim myScsi As RegistryKey
Dim myPort As RegistryKey
Dim myBus As RegistryKey
Dim myHd As RegistryKey
Dim myInfo As RegistryKey
Dim myHW As RegistryKey
Dim myLM As RegistryKey
'LocalMachine这个你打开注册表对一下就知道了
myLM = Registry.LocalMachine
'读子键
myHW = myLM.OpenSubKey("HARDWARE")
myDec = myHW.OpenSubKey("DEVICEMAP")
myScsi = myDec.OpenSubKey("Scsi")
myPort = myScsi.OpenSubKey("Scsi Port 1")
myBus = myPort.OpenSubKey("Scsi Bus 0")
myHd = myBus.OpenSubKey("Target Id 0")
myInfo = myHd.OpenSubKey("Logical Unit Id 0")
'得到值
dStr = myInfo.GetValue("Identifier").ToString.Trim & ""
'Msgbox
msgbox (dStr)
[此贴子已经被作者于2007-7-24 15:02:36编辑过]
要不要 dim dStr as string?
你说要不要呢?
出错?
你打开注册表看看有没有"Logical Unit Id 0"这个子键
没有的话当然出错