📄 mdnumericpassword.bas
字号:
Attribute VB_Name = "MDNumericPassword"
Option Explicit
Public Const GWL_WNDPROC = (-4)
Public Const WM_LBUTTONDOWN = &H201
Public Const WM_RBUTTONDOWN = &H204
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public prevWndProc As Long
Function WndProc(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
If Msg = WM_RBUTTONDOWN Then
Msg = WM_LBUTTONDOWN
End If
WndProc = CallWindowProc(prevWndProc, hwnd, Msg, wParam, lParam)
End Function
'将你输入的每个字符转换成密码数字
Public Function Fun_NumericPassword(ByVal Password As String) As Long
Dim nValue As Long
Dim ch As Long
Dim Shift1 As Long
Dim Shift2 As Long
Dim i As Integer
Dim Str_Len As Integer
'得到字符串内字符的数目
Str_Len = Len(Password)
'给每个字符转换成密码数字
For i = 1 To Str_Len
ch = Asc(Mid$(Password, i, 1))
nValue = nValue Xor (ch * 2 ^ Shift1)
nValue = nValue Xor (ch * 2 ^ Shift2)
Shift1 = (Shift1 + 7) Mod 19
Shift2 = (Shift2 + 13) Mod 23
Next i
Fun_NumericPassword = nValue
End Function
Public Function Fun_OpenDatFile(i As Boolean) As String
On Error Resume Next
Dim LoadFiles As String
Dim Filenum As Integer
Dim StrTarget As String, NumTarget As Integer
LoadFiles = "fw.dl"
Filenum = FreeFile
'读取加密文件
Open LoadFiles For Random As Filenum
Get #Filenum, 1, StrTarget '读取密码
Get #Filenum, 2, NumTarget '启动密码登录开关
Close Filenum
If i = True Then
Fun_OpenDatFile = StrTarget '读取密码
Else
Fun_OpenDatFile = NumTarget '启动密码登录开关
End If
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -