VB下,如何获取U盘出厂ID,最好能给出源代码,急救呀!
如题!
[解决办法]
使用WMI读取.
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_USBHub")
For Each objitem In colItems
a = objitem.DeviceID
If a Like "*VID*" Then
b = Split(a, "\")
c = Split(b(UBound(b) - 1), "&")
d = Split(c(UBound(c) - 1), "_")
e = Split(c(UBound(c)), "_")
'以上获取出相关参数
U_Dist = d(UBound(d)) + e(UBound(e)) + b(UBound(b))
MsgBox U_Dist
End If
Next