|
文档使用U盘物理序列号限制的代码如下(就是没有办法获取到K盘符的U盘,是不是很下面的代码不支持E盘符以上的U盘,我的K盘符U盘那代码需要怎么修改呢):
Private Sub Workbook_Open()
Dim objWMIService As Object
Dim colItems As Object
Dim objitem As Object
Dim a, b, c, d, e, U_Dist
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))
If U_Dist = "1307016300000000000027" Then Exit Sub 'U盘物理序列号
End If
Next
MsgBox "找不到正确U盘,系统将退出!"
ThisWorkbook.Close False
End Sub |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|