《如何通过C语言,读取U盘序列号VID》
《如何通过C语言,读取U盘序列号》,谢谢了。下面是vb的代码;
Function CC()
On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_USBHub")
For Each objItem In colItems
a = objItem.DeviceID 'U盘识别为:USB\VID_09A6&PID_800\20040418154911-00,故用VID判别
If a Like "*VID*" Then b = Split(a, "\")
CC = b(UBound(b))
'上句亦可:If InStr(a, "VID") Then b = Split(a, "\"): MsgBox b(UBound(b))
Next
End Function