📄 reg.frm
字号:
VERSION 5.00
Begin VB.Form regMain
BorderStyle = 1 'Fixed Single
Caption = "注册"
ClientHeight = 5985
ClientLeft = 45
ClientTop = 435
ClientWidth = 6480
Icon = "reg.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5985
ScaleWidth = 6480
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command3
Caption = "关闭注册窗口"
Height = 255
Left = 4320
TabIndex = 8
Top = 5640
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "注册"
Height = 255
Left = 5400
TabIndex = 6
Top = 5160
Width = 735
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 270
Left = 3240
TabIndex = 5
Top = 5152
Width = 2055
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000012&
BorderStyle = 0 'None
ForeColor = &H80000009&
Height = 200
Left = 1320
Locked = -1 'True
TabIndex = 3
Top = 5187
Width = 1215
End
Begin VB.PictureBox Picture1
Height = 4815
Left = 120
ScaleHeight = 4755
ScaleWidth = 6195
TabIndex = 0
Top = 120
Width = 6255
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = $"reg.frx":1982
Height = 4695
Left = 240
TabIndex = 1
Top = 120
Width = 5775
End
End
Begin VB.Shape Shape1
Height = 495
Left = 120
Top = 5040
Width = 6135
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "未注册!"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 285
Left = 2400
TabIndex = 7
Top = 5640
Width = 1005
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "注册码:"
Height = 180
Left = 2640
TabIndex = 4
Top = 5197
Width = 630
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "产品标识码:"
Height = 180
Left = 240
TabIndex = 2
Top = 5197
Width = 990
End
End
Attribute VB_Name = "regMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mainstr, appStr As String
Private Sub Command1_Click()
Dim sn, sn1 As String
'注册码写入注册表
CreateNewKey HKEY_CURRENT_USER, appStr
sn1 = serival
'注册码格式化
sn = ""
For i = 0 To 3
sn = sn + Mid(Text2.Text, i * 4 + 1 + i, 4)
Next
If sn1 = sn Then
SetKeyValue HKEY_CURRENT_USER, appStr, "ser", sn, REG_SZ
MsgBox "恭喜您,注册成功!!", vbOKOnly, "注册成功之路"
Else
MsgBox "注册码错误!"
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Dim sn, sn1 As String
Text1.Text = GetSerialNumber("c:\")
sn = QueryValue(HKEY_CURRENT_USER, appStr, "ser")
sn1 = serival
If sn = "" Then
Text2.Text = "请输入正确注册码!"
ElseIf Len(sn) <> 0 Then
If sn1 = Left(sn, 16) Then
Label7.Caption = "正版用户!"
'按固定格式显示注册号
Text2.Text = "感谢您注册使用!"
Command1.Visible = False
Text1.Text = ""
Else
Text2.Text = "请输入正确注册码!"
Label7.Caption = "未注册!"
Text2.Enabled = True
Command1.Visible = True
End If
End If
End Sub
Public Function serival() As String
'计算注册码
serival = md5(Trim(Text1.Text) & "1276")
End Function
Private Sub Text2_GotFocus()
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
End Sub
Private Sub Text2_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Text2.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -