?? frmlogin.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 + -