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

📄 frmlogin.frm

📁 智能邮件管理信息系统
💻 FRM
字号:
VERSION 5.00
Object = "{BAF65C40-D20A-4859-BD31-DDD757D8C4D1}#1.0#0"; "ComboListDrawing.ocx"
Begin VB.Form frmLogin 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ClientHeight    =   2445
   ClientLeft      =   2835
   ClientTop       =   3480
   ClientWidth     =   4530
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1444.587
   ScaleMode       =   0  'User
   ScaleWidth      =   4253.426
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CheckBox BlnIsSytem 
      Caption         =   "管理员身份登录"
      Height          =   255
      Left            =   1410
      TabIndex        =   7
      Top             =   1410
      Width           =   2055
   End
   Begin VB.TextBox strPassWord 
      Height          =   315
      IMEMode         =   3  'DISABLE
      Left            =   1410
      PasswordChar    =   "*"
      TabIndex        =   6
      Top             =   570
      Width           =   2685
   End
   Begin ComboListDrawing.ComboListDraw strOperatorName 
      Height          =   315
      Left            =   1410
      TabIndex        =   5
      Top             =   150
      Width           =   2685
      _ExtentX        =   4736
      _ExtentY        =   582
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   9
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   -2147483630
      MaxLength       =   0
   End
   Begin VB.CheckBox BlnRemenber 
      Caption         =   "记住录入"
      Height          =   315
      Left            =   1440
      TabIndex        =   4
      Top             =   990
      Width           =   1155
   End
   Begin VB.CommandButton cmdOK 
      Height          =   350
      Index           =   0
      Left            =   1530
      Style           =   1  'Graphical
      TabIndex        =   3
      Tag             =   "1001"
      Top             =   1830
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
   Begin VB.CommandButton cmdOK 
      Height          =   350
      Index           =   2
      Left            =   2940
      Style           =   1  'Graphical
      TabIndex        =   2
      Tag             =   "1009"
      Top             =   1830
      UseMaskColor    =   -1  'True
      Width           =   1215
   End
   Begin VB.Label lblLabels 
      Caption         =   "用户名称(&U):"
      Height          =   195
      Index           =   0
      Left            =   240
      TabIndex        =   0
      Top             =   210
      Width           =   1080
   End
   Begin VB.Label lblLabels 
      Caption         =   "密码(&P):"
      Height          =   195
      Index           =   1
      Left            =   240
      TabIndex        =   1
      Top             =   630
      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


'可调整的常量声明
Const APP_CATEGORY = "redsun"
Const AppName = "SmartMail"

Private LoginOperatorID As Long
Private MBlnIsSytem As Boolean


'********************************************************************************
'类,类型定义
Private mEmployee  As PEmployee.Employee
Private mEmployees As PEmployee.Employees
Private mclsEmployee As PEmployee.clsEmployee
'********************************************************************************
                                                                                       
Private Sub cmdOK_Click(Index As Integer)
    If Index = 0 Then
        If Not strOperatorName.Id > 0 Then
            MsgBox "请选择需要登录的操作员!", vbOKOnly, "提示"
            strOperatorName.SetFocus
            LoginOperatorID = 0
            Exit Sub
        End If
        
        mclsEmployee.GetEmployee strOperatorName.Id, mEmployee
        '如果不是系统操作员,不能够以系统操作员身份登陆
        If BlnIsSytem.value = 1 Then
            If Not mEmployee.blnIsSystem Then
                MsgBox "不是系统操作员,不能够以系统操作员身份登陆!", vbOKOnly, "提示"
                Exit Sub
            End If
        End If
        
        If mEmployee.strPassWord = strPassWord.Text Then
            LoginOperatorID = strOperatorName.Id
            MBlnIsSytem = IIf(BlnIsSytem.value = 1, True, False)
            
            '记住密码和用户
            If BlnRemenber.value = 1 Then
                SaveRegistryString "LoginOperatorID", strOperatorName.Id
                mEmployee.BlnRemeberMe = 1
                mclsEmployee.SaveEmployee mEmployee, False, True
            End If
            
            Unload Me
        Else
            MsgBox "密码错误!", vbOKOnly, "提示"
            strPassWord.SetFocus
            LoginOperatorID = 0
            Exit Sub
        End If
    Else
        Unload Me
        LoginOperatorID = 0
    End If
End Sub


Private Sub Form_Load()
    cmdOK(0).Picture = LoadResPicture(1001, vbResBitmap)
    cmdOK(2).Picture = LoadResPicture(1002, vbResBitmap)
    Me.Icon = LoadResPicture(3004, vbResIcon)
    
    Set mclsEmployee = New PEmployee.clsEmployee
    mclsEmployee.Init gdbCurrentDB
    InitOperator strOperatorName, Val(GetRegistryString("LoginOperatorID", 0))
    
    mclsEmployee.GetEmployee Val(GetRegistryString("LoginOperatorID", 0)), mEmployee
    
    If mEmployee.LngEmployeeID > 0 Then
        If mEmployee.BlnRemeberMe Then
            strPassWord.Text = mEmployee.strPassWord
        End If
        BlnRemenber.value = IIf(mEmployee.BlnRemeberMe, 1, 0)
    End If
End Sub





Public Sub InitOperator(ByRef cbxTmp As ComboListDraw, ByVal lngDefaultID As Long)
    Dim strsql As String
    Dim i As Long
    
    strsql = "Select * from Employee"
    
    cbxTmp.FullRowSelect = True
    mclsEmployee.GetEmployees strsql, mEmployees
    For i = 0 To mEmployees.Count
        If mEmployees.Count > 0 Then
            LSet mEmployee = mEmployees.Employee(i)
            If mEmployee.LngEmployeeID > 0 Then
                cbxTmp.AddItemAndData mEmployee.strEmployeeName, , , , , mEmployee.LngEmployeeID
            End If
        End If
    Next i
    
    cbxTmp.SeekID lngDefaultID
End Sub


Public Sub ShowLoginDialog(ByRef lngCurOperatorID As Long, ByRef BlnIsSytem As Boolean)
    Me.Show vbModal
    If LoginOperatorID > 0 Then
        lngCurOperatorID = LoginOperatorID
        BlnIsSytem = MBlnIsSytem
        Unload Me
    End If
End Sub


'取注册表信息
'Author   :Myganlimei@163.com
Function GetRegistryString(ByVal vsItem As String, ByVal vsDefault As String) As String
    GetRegistryString = GetSetting(APP_CATEGORY, AppName, vsItem, vsDefault)
End Function




'取注册表信息
'Author   :Myganlimei@163.com
Sub SaveRegistryString(ByVal vsItem As String, ByVal vsDefault As String)
    Call SaveSetting(APP_CATEGORY, AppName, vsItem, vsDefault)
End Sub

Private Sub strOperatorName_Click()
    mclsEmployee.GetEmployee Val(strOperatorName.Id), mEmployee
    
    If mEmployee.LngEmployeeID > 0 Then
        If mEmployee.BlnRemeberMe Then
            strPassWord.Text = mEmployee.strPassWord
        Else
            strPassWord.Text = ""
        End If
        BlnRemenber.value = IIf(mEmployee.BlnRemeberMe, 1, 0)
    End If
End Sub

⌨️ 快捷键说明

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