- UID
- 676430
- 积分
- 379
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2013-5-20
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
根据VB源码改成
VB如下
'根据U盘盘符获取序列号
Private Function GetUSBVID(usbPath As String) As String
Dim objWMIService As Object
Dim USBDevices As Object, USBDevice As Object, USBDiskPartitions As Object, USBDiskPartition As Object, LogicalUSBDisks As Object, LogicalUSBDisk As
Object
Dim strID() As String
Dim Finded As Boolean
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set USBDevices = objWMIService.execquery("Select * From Win32_DiskDrive where InterfaceType='USB'")
For Each USBDevice In USBDevices
If Finded Then Exit For
Set USBDiskPartitions = objWMIService.execquery("Associators of {Win32_DiskDrive.DeviceID='" & USBDevice.DeviceId & "'} where AssocClass =
Win32_DiskDriveToDiskPartition")
For Each USBDiskPartition In USBDiskPartitions
Set LogicalUSBDisks = objWMIService.execquery("Associators of {Win32_DiskPartition.DeviceID='" & USBDiskPartition.DeviceId & "'} where AssocClass
= Win32_LogicalDiskToPartition")
For Each LogicalUSBDisk In LogicalUSBDisks
If LogicalUSBDisk.DeviceId = UCase(usbPath) Then
strID = Split(USBDevice.PNPDeviceID, "\")
strID = Split(strID(UBound(strID)), "&")
GetUSBVID = strID(0)
Finded = True
End If
Next
Next
DoEvents
Next
Set USBDevices = Nothing
Set USBDevice = Nothing
Set USBDiskPartitions = Nothing
Set USBDiskPartition = Nothing
Set LogicalUSBDisks = Nothing
Set LogicalUSBDisk = Nothing
End Function
每次都是拿豆豆买,这次卖出去,价廉物美,大伙快买
|
评分
-
查看全部评分
|