📄 p.frm
字号:
VERSION 5.00
Object = "{90F3D7B3-92E7-44BA-B444-6A8E2A3BC375}#1.0#0"; "ACTSKIN4.OCX"
Begin VB.Form frmPassword
AutoRedraw = -1 'True
BorderStyle = 3 'Fixed Dialog
Caption = "密码设置"
ClientHeight = 1440
ClientLeft = 45
ClientTop = 330
ClientWidth = 4440
Icon = "p.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 96
ScaleMode = 3 'Pixel
ScaleWidth = 296
StartUpPosition = 2 '屏幕中心
Begin ACTIVESKINLibCtl.Skin Skin1
Left = 3900
OleObjectBlob = "p.frx":1D42
Top = 300
End
Begin VB.CommandButton CmdSave
Caption = "确 定"
Height = 435
Left = 3240
TabIndex = 4
Top = 210
Width = 1005
End
Begin VB.CommandButton CmdExit
Caption = "退 出"
Height = 435
Left = 3240
TabIndex = 3
Top = 810
Width = 1035
End
Begin VB.TextBox txtOld
ForeColor = &H0000FF00&
Height = 270
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 0
Top = 180
Width = 1815
End
Begin VB.TextBox txtPass
ForeColor = &H000000FF&
Height = 270
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 1
Top = 540
Width = 1815
End
Begin VB.TextBox txtRepass
ForeColor = &H00FF0000&
Height = 270
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 2
Top = 900
Width = 1815
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel4
Height = 285
Index = 2
Left = 120
OleObjectBlob = "p.frx":4C231
TabIndex = 5
Top = 930
Width = 1215
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel4
Height = 285
Index = 0
Left = 300
OleObjectBlob = "p.frx":4C292
TabIndex = 6
Top = 210
Width = 825
End
Begin ACTIVESKINLibCtl.SkinLabel SkinLabel4
Height = 285
Index = 1
Left = 300
OleObjectBlob = "p.frx":4C2EF
TabIndex = 7
Top = 570
Width = 825
End
End
Attribute VB_Name = "frmPassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdSave_Click()
On Error Resume Next
If txtOld.Text <> FRMreg.PassText Then
MsgBox "你输入的旧密码不正确!", vbExclamation, "错误"
txtOld.Text = Empty: txtOld.SetFocus: Exit Sub
Else
If txtPass.Text <> txtRepass.Text Then
MsgBox "新密码与确认密码不一样 请重新输入", vbExclamation, "错误"
txtPass.Text = Empty: txtRepass.Text = Empty
txtPass.SetFocus
Exit Sub
End If
FRMreg.PassText = txtPass.Text
End If
'将你输入的密码 加密 到 Cipher_Text 的变量里
Dim Cipher_Text As String
Mod_Cipher txtPass.Text, txtPass.Text, Cipher_Text
'保存到文件并加密
Dim Filenum As Integer
Filenum = FreeFile '提供一个尚未使用的文件号
Dim LoadFiles As String
LoadFiles = "fw.dl"
Open LoadFiles For Random As Filenum
Put #Filenum, 1, Cipher_Text '把 Cipher_Text 的变量写入文件里
Close Filenum
'设置该文件为隐藏属性
SetAttr (LoadFiles), vbHidden
If Err Then MsgBox Error$, vbCritical, Me.Caption: Exit Sub
'已经成功地更改了密码!
If Dir(LoadFiles, vbHidden) <> Empty And txtPass.Enabled = True Then
MsgBox "已经成功地更改了密码!", vbInformation, Me.Caption
End If
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
MAIN.Enabled = True
Dim ws As Workspace
Dim db As Database
Dim rs As Recordset
For Each ws In Workspaces
For Each db In ws.Databases
For Each rs In db.Recordsets
rs.Close
Set rs = Nothing
Next
db.Close
Set db = Nothing
Next
ws.Close
Set ws = Nothing
Next
End Sub
Private Sub cmdexit_Click()
On Error Resume Next
Unload Me
End Sub
'加密子程序
Private Sub Mod_Cipher(ByVal Password As String, ByVal From_Text As String, To_Text As String)
On Error Resume Next
Const MIN_ASC = 32 ' Space.
Const MAX_ASC = 126 ' ~.
Const NUM_ASC = MAX_ASC - MIN_ASC + 1
Dim offset As Long
Dim Str_Len As Integer
Dim i As Integer
Dim ch As Integer
'得到了加密的数字
offset = Fun_NumericPassword(Password)
Rnd -1
'对随机数生成器做初始化的动作
Randomize offset
Str_Len = Len(From_Text)
For i = 1 To Str_Len
ch = Asc(Mid$(From_Text, i, 1))
If ch >= MIN_ASC And ch <= MAX_ASC Then
ch = ch - MIN_ASC
offset = Int((NUM_ASC + 1) * Rnd)
ch = ((ch + offset) Mod NUM_ASC)
ch = ch + MIN_ASC
To_Text = To_Text & Chr$(ch)
End If
Next i
End Sub
Private Sub Form_Load()
On Error Resume Next
' Skin1.LoadSkin App.Path & "\SKIN\4.sk"
Skin1.ApplySkin Me.hwnd
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -