获得硬盘序列号,生成序列号,每次启动时验证一下Public Function getdiskid() As String
Dim aa As Long
Dim VolName As String
Dim fsysName As String
Dim path As String
Dim VolSeri As Long, compress As Long
Dim Sysflag As Long, Maxlen As Long
VolName = String(255, 0)
fsysName = String(255, 0)
aa = GetVolumeInformation(path, VolName, 256, VolSeri, Maxlen, Sysflag, fsysName, 256)
getdiskid = Hex(VolSeri)
End Function
Dim aa As Long
Dim VolName As String
Dim fsysName As String
Dim path As String
Dim VolSeri As Long, compress As Long
Dim Sysflag As Long, Maxlen As Long
VolName = String(255, 0)
fsysName = String(255, 0)
aa = GetVolumeInformation(path, VolName, 256, VolSeri, Maxlen, Sysflag, fsysName, 256)
getdiskid = Hex(VolSeri)
End Function
解决方案 »
- 如何把时间换成分钟
- VB统一坐标!请高手帮忙!
- VB6,ACCESS2000开发的程序,如何将数据库改为ORACLE 9i,请高手赐教!
- 关于vb动态加载控件的事件中改变事件参数的值
- 如何用rs对象执行一个sql查询语句,并获取查询后的指计是否为eof?
- 请问一条简单的SQL语句!
- 哪为仁兄知道水晶报表8。0的安装cd key code??
- 哪位大虾有数据库底层连接类?在线等。。来者给分
- ADO与 带密码的Access2000连接问题
- 一个进销存软件用vb做,不用access数据库,用sql sever ,但~~~~~
- 急急。。。一个关于局域网winsock问题,大侠请进!!!
- 很难的问题,高手请进?
http://www.applevb.com/sourcecode/volser.zip
VB是没办法直接读取物理号的。
Dim TVal As Long
Dim i As Integer 'Variable Declaration
Dim TText As String
Dim TString As String
TString = "" 'Reset the variable
pb.Max = Len(Username) 'Set the scroll bars MAX property to the length of the Username
Me.Caption = Me.Caption & " [Building Key...]" 'Change the caption of the window while generating
For i = 1 To Len(Username) ' Start the loop using the length of the username
pb.Value = i 'Show the status of the generation
TVal = Asc(Mid(Username, i, 1)) + 2 'Converts the next letter of username to it's ASCII value, then add's 2
TVal = TVal + Fix((TVal * (16 + Len(Username)))) 'This adds the last result with 16 * the length of the username
TVal = TVal + Len(Username) 'It adds to the last result the length of the Username
TString = TString & Trim(StrReverse(Str(TVal))) 'This reverses the last result and appends it to the last result in TString
Next i 'Continue getting the next letter in Username
TText = TString 'This puts the generated key into TText
If Len(TText) >= 8 Then 'This tests to see if the length of the key is 8 or greater
Mid(TText, 4, 1) = "-" 'If so then place a hypen in the key
Mid(TText, 12, 1) = "-" 'Place another hypen in the key
End If
TText = Left(TText, 16) 'This trims the key down making it look nice :o)
Me.Caption = "Key Master by Chazter" 'This returns the caption to it's former state
GenKey = TText 'This makes the function equal to the generated key
End Function
你可以找到吗哪DDK的例程吗?