感谢Zamyi提供获取U盘物理序列号的方法! 105楼有获取U盘物理序列号的方法 利用U盘作为密钥盘,用U盘的物理序列号作为 密钥,对Excel文件进行加密(已通过测试)。 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
[此贴子已经被作者于2008-9-18 22:09:51编辑过] |