frmlogin.frm

来自「电梯检测系统是对电梯性能进行检测的系统。是一个用来学习的程序。」· FRM 代码 · 共 255 行

FRM
255
字号
VERSION 5.00
Begin VB.Form FrmLogin 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "PassWord"
   ClientHeight    =   2715
   ClientLeft      =   2220
   ClientTop       =   2775
   ClientWidth     =   6990
   Icon            =   "FrmLogin.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2715
   ScaleWidth      =   6990
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Tag             =   "登录"
   Begin VB.Frame Frame1 
      Caption         =   "User Login"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00000000&
      Height          =   1905
      Left            =   120
      TabIndex        =   3
      Top             =   240
      Width           =   4785
      Begin VB.TextBox txtPassword 
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00404040&
         Height          =   360
         IMEMode         =   3  'DISABLE
         Left            =   3000
         PasswordChar    =   "*"
         TabIndex        =   0
         Top             =   795
         Width           =   1575
      End
      Begin VB.Image ImgFocus 
         Height          =   240
         Left            =   240
         Picture         =   "FrmLogin.frx":0442
         Top             =   840
         Width           =   240
      End
      Begin VB.Image Image3 
         Height          =   315
         Left            =   2640
         Picture         =   "FrmLogin.frx":0544
         Top             =   840
         Width           =   315
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Enter Your PassWord"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00808080&
         Height          =   285
         Left            =   570
         TabIndex        =   5
         Top             =   1440
         Width           =   2460
      End
      Begin VB.Label lblLabels 
         Caption         =   "PassWord(&P):"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   345
         Index           =   1
         Left            =   720
         TabIndex        =   4
         Tag             =   "密码(&P):"
         Top             =   840
         Width           =   1920
      End
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "Cancel(&C)"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Left            =   5160
      TabIndex        =   2
      Tag             =   "取消"
      Top             =   1080
      Width           =   1740
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "Enter(&Y)"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   465
      Left            =   5160
      TabIndex        =   1
      Tag             =   "确定"
      Top             =   360
      Width           =   1740
   End
End
Attribute VB_Name = "FrmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private OK As Boolean
Private ChangeYn As Boolean
Private SysGh As String
Private PassW As String
Private IntkeyinPwd As Integer    'counter of try number


Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
IntkeyinPwd = 0
'Screen.MousePointer = 0
Me.Caption = App.ProductName + "  " + Format(Date, "yyyy/mm/dd")

PassW = GetFromINI("Password", "Password", App.Path & "\ini\Missys.ini")

If Trim$(txtPassword.Text) <> "" Then
   txtPassword.TabIndex = 0
End If
End Sub

Private Sub CmdCancel_Click()
'Screen.MousePointer = 0
Unload Me
FillComp = True
End Sub
Private Sub CmdOK_Click()
Dim CheckPass As String
Dim TempWid As Single
On Error GoTo ErrLogin
'Screen.MousePointer = 11
Me.Enabled = False
IntkeyinPwd = IntkeyinPwd + 1    'counte try number
If IntkeyinPwd > 3 Then          'can't > IntMaxKeyinPwd
    SetWindowPos DefMsgBox.hwnd, HWND_TOPMOST, 200, 100, 400, 185, SWP_SHOWWINDOW
    DefMsgBox.Text1 = " Retry more times,Exit.  "
    DefMsgBox.Caption = "System Warning"
    DefMsgComp = False
    Do Until DefMsgComp
      DoEvents
    Loop
    Me.Enabled = True
    'Screen.MousePointer = 0
    Unload Me
    Exit Sub
End If

If Len(txtPassword) = 0 Then
    SetWindowPos DefMsgBox.hwnd, HWND_TOPMOST, 200, 100, 400, 185, SWP_SHOWWINDOW
    DefMsgBox.Text1 = " Enter PassWord.  "
    DefMsgBox.Caption = "PassWord"
    DefMsgComp = False
    Do Until DefMsgComp
      DoEvents
    Loop
    Me.Enabled = True
    txtPassword.SetFocus
    'Screen.MousePointer = 0
    Exit Sub
End If
CheckPass = Trim$(txtPassword.Text)
'判断用户帐号,口令是否正确
If CheckPass <> PassW Then
    SetWindowPos DefMsgBox.hwnd, HWND_TOPMOST, 200, 100, 400, 185, SWP_SHOWWINDOW
    DefMsgBox.Text1 = " Error Password!This project is proteced by password.Only when you enter correct password,you can do this project."
    DefMsgBox.Caption = "Warning"
    DefMsgComp = False
    Do Until DefMsgComp
      DoEvents
    Loop
   Me.Enabled = True
   txtPassword.SelStart = 0
   txtPassword.SelLength = Len(txtPassword)
   txtPassword.SetFocus
   'Screen.MousePointer = 0
   Exit Sub
End If

'Screen.MousePointer = 0
Unload Me
FillComp = True
FillSucc = True
Exit Sub
ErrLogin:
    'Screen.MousePointer = 0
    MsgBox Err.Description, vbInformation
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  FillComp = True
End Sub

Private Sub txtPassword_GotFocus()
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword)
ImgFocus.top = txtPassword.top + 10
End Sub



⌨️ 快捷键说明

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