⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mdlpublic.bas

📁 采购信息录入系统,相对来说
💻 BAS
字号:
Attribute VB_Name = "mdlPublic"
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public strClerkFlag As String
Public strGuestFlag As String
Public strFittingFlag As String
Public strJobListFlag As String
Public gMainFormRefer As Form
Public gblnLoginSucceeded As String
Public gstrCurOperatorName As String
Public Const gDecipher = "123456"
Public strMDI As String




Function ValiText(KeyIn As Integer, ValidateString As String, Editable As Boolean) As Integer
    Dim ValidateList As String
    Dim KeyOut As Integer
    If Editable = True Then
        ValidateList = UCase(ValidateString) & Chr(8)
    Else
        ValidateList = UCase(ValidateString)
    End If
    If InStr(1, ValidateList, UCase(Chr(KeyIn)), 1) > 0 Then
        KeyOut = KeyIn
    Else
        KeyOut = 0
        Beep
    End If
    ValiText = KeyOut
End Function

Public Function Cipher(ByVal password As String) As String
    Const MIN_ASC = 32
    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
    Dim to_text As String

   
    offset = NumericPassword(password)
    Rnd -1
    Randomize offset

    to_text = ""
    str_len = Len(gDecipher)
    For i = 1 To str_len
        ch = Asc(Mid$(gDecipher, 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
    Cipher = to_text
End Function

Private Function Decipher(ByVal password As String, ByVal from_text As String) As String
    Const MIN_ASC = 32
    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
    Dim to_text As String

    offset = NumericPassword(password)
    Rnd -1
    Randomize offset

    str_len = Len(from_text)
    to_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)
            If ch < 0 Then ch = ch + NUM_ASC
            ch = ch + MIN_ASC
            to_text = to_text & Chr$(ch)
        End If
    Next i
    Decipher = to_text
End Function

Public Function NumericPassword(ByVal password As String) As Long
    Dim value 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))
        value = value Xor (ch * 2 ^ shift1)
        value = value Xor (ch * 2 ^ shift2)

        shift1 = (shift1 + 7) Mod 19
        shift2 = (shift2 + 13) Mod 23
    Next i
    NumericPassword = value
End Function

Public Sub CheckExist(fm As Form)
    Dim title As String
    If App.PrevInstance Then
        title = App.title
        Call MsgBox("本程序已经执行!", vbCritical, "登陆提示")
        App.title = ""
        fm.Caption = ""
        AppActivate title
    End
    End If
End Sub

Public Sub MoveToCenter(ByVal ParentForm As Form, ByRef theForm As Form)
    On Error Resume Next
    theForm.Move (ParentForm.ScaleWidth - theForm.Width) / 2, (ParentForm.ScaleHeight - theForm.Height) / 2, theForm.Width, theForm.Height
    On Error GoTo 0
End Sub



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -