参考:
Dim str As String =ComputerId
Dim Asc As New ASCIIEncoding
Dim AscArr() As Byte = Asc.GetBytes(str)
Dim Arys As String
For i As Integer = 0 To AscArr.Length - 1
Arys= Arys & AscArr(i)
Next
e.Form.Controls("机器码").Value = (Arys.SubString(0,4))
e.Form.Controls("机器码1").Value = (Arys.SubString(4,4))
e.Form.Controls("机器码2").Value = (Arys.SubString(8,4))
e.Form.Controls("机器码3").Value = (Arys.SubString(12,4))
e.Form.Controls("机器码4").Value = (Arys.SubString(16,4))
e.Form.Controls("机器码5").Value = (Arys.SubString(20,4))
此主题相关图片如下:1.jpg
或
If HardWareInfo.Ready = False '如果没有初始化
HardWareInfo.Initialize '初始化HardWareInfo,提取硬件信息
End If
Dim Val1 As String
Dim Val2 As String
Dim Val3 As String
Dim Val4 As String
With HardWareInfo.CPU
val1= .ProcessorId
End With
With HardWareInfo.BaseBoard
val2= .SerialNumber
End With
With HardWareInfo.Disk
val3= .Signature
End With
With HardWareInfo.Bios
val4= .SerialNumber
End With
Dim Val5 As String = EncryptText(Val1 & Val2 & Val3 & Val4,"a23","op#")
Dim str As String = Val5 'ComputerId
Dim Asc As New ASCIIEncoding
Dim AscArr() As Byte = Asc.GetBytes(str)
Dim Arys As String
For i As Integer = 0 To AscArr.Length - 1
Arys= Arys & AscArr(i)
Next
e.Form.Controls("机器码".Value = Arys & "*" & len(Arys)
抽取其中的数字组成机器码
最好再加入一个算法(公式),机器码用公式算出注册码,