📄 frmkey.frm
字号:
VERSION 5.00
Begin VB.Form frmKey
BorderStyle = 3 'Fixed Dialog
Caption = "软件注册"
ClientHeight = 3210
ClientLeft = 30
ClientTop = 420
ClientWidth = 6015
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3210
ScaleWidth = 6015
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command2
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 490
Left = 4320
TabIndex = 5
Top = 2640
Width = 1330
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 370
Left = 1320
TabIndex = 3
Top = 1800
Width = 3612
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 490
Left = 2760
TabIndex = 2
Top = 2640
Width = 1450
End
Begin VB.Label Label3
Caption = "注册码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 480
TabIndex = 4
Top = 1800
Width = 1332
End
Begin VB.Label Label2
BorderStyle = 1 'Fixed Single
Caption = "1e2ebcaaaaaadwkey"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 1320
TabIndex = 1
Top = 1320
Width = 3612
End
Begin VB.Label Label1
Caption = $"frmKey.frx":0000
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 360
TabIndex = 0
Top = 240
Width = 5295
End
End
Attribute VB_Name = "frmKey"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetVolumeInformation Lib _
"kernel32.dll" Alias "GetVolumeInformationA" (ByVal _
lpRootPathName As String, ByVal lpVolumeNameBuffer As _
String, ByVal nVolumeNameSize As Integer, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength _
As Long, lpFileSystemFlags As Long, ByVal _
lpFileSystemNameBuffer As String, ByVal _
nFileSystemNameSize As Long) As Long
Dim pscard As New ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim snn As String
Private Sub Command1_Click() '注册
Dim strkey As String
Dim skeyPI(8) As Byte
Dim skeyID(8) As Byte
Dim skeyLA(8) As Byte
Dim i As Integer
Dim n As Integer
n = 1
For i = 0 To 7
skeyID(i) = "&H" + Mid(snn, n, 2)
n = n + 2
Next i
skeyPI(0) = &HAA
skeyPI(1) = &H19
skeyPI(2) = &HBB
skeyPI(3) = &H76
skeyPI(4) = &HCC
skeyPI(5) = &H4
skeyPI(6) = &HDD
skeyPI(7) = &H19
st = ic_encrypt(skeyPI(0), skeyID(0), 8, skeyLA(0)) 'KEY
strkey = ""
For i = 0 To 7
strkey = strkey & Right("00" + hex(skeyLA(i)), 2)
Next i
' strKey = Crypt(Label2.Caption, "19760419")
If Text1.Text = strkey Then
Set rs = GetRecordset(maSys_db, "select * from LinkLoginList where keyname='" & Trim(Label2.Caption) & "'")
If Not (rs.EOF And rs.BOF) Then
If rs!keypassword = strkey Then
MsgBox "已经注册!", vbCritical + vbOKOnly, "提示"
Else
maSys_db.Execute "update LinkLoginList set keypassword='" & strkey & "' where keyname='" & Trim(Label2.Caption) & "'"
MsgBox "注册成功!", vbInformation + vbOKOnly, "提示"
End If
sJc = "注册成功"
Unload Me
Exit Sub
End If
pscard.Open "select * from LinkLoginList", maSys_db, 3, 3
pscard.AddNew
pscard.Fields("keyname") = Trim(Label2.Caption)
pscard.Fields("keypassword") = strkey
pscard.Update
pscard.Close
sJc = "注册成功"
MsgBox "注册成功!", vbInformation + vbOKOnly, "提示"
Unload Me
Else
MsgBox "注册不成功,请与供应商联系!", vbCritical + vbOKOnly, "警告": Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Function GetSerialNumber(strDrive As String) As Long
Dim SerialNum As Long
Dim Res As Long
Dim Temp1 As String
Dim Temp2 As String
Temp1 = String$(255, Chr$(0))
Temp2 = String$(255, Chr$(0))
Res = GetVolumeInformation(strDrive, Temp1, _
Len(Temp1), SerialNum, 0, 0, Temp2, Len(Temp2))
GetSerialNumber = SerialNum
End Function
Private Sub Form_Load()
Dim Name As String, Length As Long
Dim sN As String
sN = Right(Format(GetSerialNumber("c:\"), "00000000000000"), 12)
snn = sN & "3721"
sN = "1976-" & Mid(sN, 1, 4) & "-" & Mid(sN, 5, 4) & "-" & Mid(sN, 9, 4) & "-3721"
Label2.Caption = sN
Me.Top = (Screen.Height - Me.Height) / 2 + 200
Me.Left = (Screen.Width - Me.Width) / 2
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -