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

📄 frmlogin.frm

📁 这是一本学习串口编程喝计算机监控的好书里面是用VB开发的源代码
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ClientHeight    =   1545
   ClientLeft      =   2835
   ClientTop       =   3480
   ClientWidth     =   3750
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   912.837
   ScaleMode       =   0  'User
   ScaleWidth      =   3521.047
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox txtUserName 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   345
      Left            =   1290
      MaxLength       =   4
      TabIndex        =   0
      Top             =   120
      Width           =   2325
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确认"
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   390
      Left            =   2160
      TabIndex        =   2
      Top             =   1020
      Width           =   1140
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   390
      Left            =   480
      TabIndex        =   3
      Top             =   1020
      Width           =   1140
   End
   Begin VB.TextBox txtPassword 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   345
      IMEMode         =   3  'DISABLE
      Left            =   1290
      MaxLength       =   6
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   525
      Width           =   2325
   End
   Begin MSAdodcLib.Adodc AdodcCaller 
      Height          =   330
      Left            =   0
      Top             =   0
      Visible         =   0   'False
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "AdodcCaller"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Label lblLabels 
      Alignment       =   2  'Center
      Caption         =   "工号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   270
      Index           =   0
      Left            =   105
      TabIndex        =   4
      Top             =   150
      Width           =   1080
   End
   Begin VB.Label lblLabels 
      Alignment       =   2  'Center
      Caption         =   "密码"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   270
      Index           =   1
      Left            =   105
      TabIndex        =   5
      Top             =   540
      Width           =   1080
   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 Sub SetMainMenu()
    With frmMain
        If nOperatorID = ID_SUPER Then
            .mCompany.Enabled = True
            .mLogs.Enabled = True
            .mLetZero.Enabled = True
        Else
            .mCompany.Enabled = False
            .mLogs.Enabled = False
            .mLetZero.Enabled = False
        End If
    End With
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    Dim nTmp As Integer
    On Error Resume Next 'CallerID
    
    nTmp = Val(txtUserName.Text)
    
    With frmOperator.AdodcCaller
        .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + _
                          strDataPath + ";Persist Security Info=False"
        .CommandType = adCmdUnknown
        .RecordSource = "select * from Operators order by [ID]"
        .Refresh
        With .Recordset
            If .RecordCount > 0 Then
                .MoveFirst
                Do While Not .EOF
                    If nTmp = ![ID] And txtPassword.Text = Base64_Decode(![Password]) Then
                        nOperatorID = nTmp
                        strOperatorPassword = txtPassword.Text
                        Exit Do
                    End If
                    .MoveNext
                Loop
                
                If .EOF Then
                    MsgBox "工号或密码错误!", vbCritical + vbOKOnly, "登录失败"
                    txtPassword.SetFocus
                    SendKeys "{Home}+{End}"
                    Exit Sub
                End If
            Else
                GoTo END_MARK            'Operator table is empty, so g on.
            End If
        End With
    End With
    
END_MARK:
    SetMainMenu
    If bLogout = False Then
        frmMain.Show
    Else
        bLogout = False
    End If
    
    
    If nOperatorID > ID_SUPER Then
        With AdodcCaller
            .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + _
                              strDataPath + ";Persist Security Info=False"
            .CommandType = adCmdUnknown
            .RecordSource = "select * from Logs order by [Date],[Login]"
            .Refresh
            
            With .Recordset
                .AddNew
                ![ID] = nOperatorID
                ![Date] = Format(Date, "yyyy-mm-dd")
                ![Login] = Format(Time, "hh:mm:ss")
                .Update
                .Requery
            End With
        End With
    End If
    
    Unload Me
End Sub

Private Sub Form_Load()
    On Error Resume Next 'CallerID
    
    strDataPath = App.Path + "\CallerID_System.mdb"
    
    If CheckFile(strDataPath) = False Then
        MsgBox "系统数据库不存在!", vbCritical + vbOKOnly, "错误"
        Exit Sub
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Unload frmOperator
End Sub

⌨️ 快捷键说明

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