?? frmlogin.frm
字號:
VERSION 5.00
Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#1.0#0"; "THREED32.OCX"
Begin VB.Form frmLogin
Caption = "登錄"
ClientHeight = 2160
ClientLeft = 2850
ClientTop = 3495
ClientWidth = 4425
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
ScaleHeight = 1276.199
ScaleMode = 0 'User
ScaleWidth = 4154.835
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox txtUserName
BackColor = &H000080FF&
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 330
Left = 1500
Style = 2 'Dropdown List
TabIndex = 1
Top = 345
Width = 2520
End
Begin Threed.SSPanel SSPanel1
Height = 360
Left = 90
TabIndex = 6
Top = 1725
Width = 4230
_Version = 65536
_ExtentX = 7461
_ExtentY = 635
_StockProps = 15
Caption = "VB中國 WWW.VB-CODE.NET"
BackColor = 12632256
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BevelOuter = 1
Font3D = 3
Begin VB.Image Image1
Height = 480
Left = 120
Picture = "frmLogin.frx":08CA
Top = -30
Width = 480
End
End
Begin VB.CommandButton cmdOK
Caption = "確定"
Default = -1 'True
Height = 390
Left = 1500
TabIndex = 4
Top = 1185
Width = 1140
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 390
Left = 2895
TabIndex = 5
Top = 1185
Width = 1140
End
Begin VB.TextBox txtPassword
BackColor = &H00E0E0E0&
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
IMEMode = 3 'DISABLE
Left = 1500
PasswordChar = "*"
TabIndex = 3
Top = 750
Width = 2520
End
Begin VB.Label lblLabels
Caption = "用戶名稱(&U):"
Height = 270
Index = 0
Left = 315
TabIndex = 0
Top = 390
Width = 1080
End
Begin VB.Label lblLabels
Caption = "密碼(&P):"
Height = 270
Index = 1
Left = 315
TabIndex = 2
Top = 765
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
Dim New_Check As New LoginCheck
Private Sub cmdCancel_Click()
'設置全局變量為 false
'不提示失敗的登錄
LoginSucceeded = False
Unload Me
End Sub
Private Sub cmdOK_Click()
Static ErrClick As Integer
'檢查正確的密碼
New_Check.DatabaseDSN = adDsn
New_Check.ConData = ConData
New_Check.ConStr = ConStr
New_Check.UserName = txtUserName
New_Check.Password = txtPassword
New_Check.GetResult
'If CheckUser(txtUserName, txtPassword) = True Then '使用CheckUser函數來檢查用戶名與口令
If New_Check.Result = True Then
sUserName = New_Check.UserName
'將代碼放在這里傳遞
'成功到 calling 函數
'設置全局變量時最容易的
LoginSucceeded = True
Me.Hide
'安裝權限設置
frmMain.LoadAuthority
frmMain.Show
Else
'三次之后退出
ErrClick = ErrClick + 1
If ErrClick > 2 Then
MsgBox "對不起,你不能使用該系統! ", vbCritical, "登錄"
Unload Me
Else
MsgBox "無效的密碼,請重試! ", vbInformation, "登錄"
txtPassword.SetFocus
SendKeys "{Home}+{End}"
End If
End If
End Sub
Private Sub Label1_Click(Index As Integer)
End Sub
Private Sub Form_Activate()
txtPassword.SetFocus
End Sub
Private Sub Form_Load()
'建立Login檢查對象
On Error Resume Next
Dim Con As Database
Dim rRecord As Recordset
Dim sSQL As String
Set Con = OpenDatabase(ConData, 0, 0, ConStr)
sSQL = "Select * From User"
Set rRecord = Con.OpenRecordset(sSQL, dbOpenDynaset)
'rRecord.Open sSql, Con, adOpenStatic, adLockPessimistic, adCmdText
If rRecord.EOF Then
rRecord.Close
Con.Close
Set rRecord = Nothing
Set Con = Nothing
MsgBox "系統沒有管理員,不能登錄! ", vbInformation
Exit Sub
Else
Do While Not rRecord.EOF
txtUserName.AddItem rRecord.Fields("UserName")
rRecord.MoveNext
Loop
rRecord.Close
Con.Close
Set rRecord = Nothing
Set Con = Nothing
Dim UserID As Integer
UserID = GetSetting(App.EXEName, "Option", "UserID", -1)
If UserID = -1 Then '第一次使用時,使用缺省值
txtUserName.ListIndex = 0
Exit Sub
Else
If txtUserName.ListCount >= UserID Then
txtUserName.ListIndex = UserID
Else
txtUserName.ListIndex = 0
End If
End If
End If
End Sub
Private Sub Form_Resize()
If Me.WindowState = 1 Then Exit Sub
On Error Resume Next
Me.Width = 4545
Me.Height = 2565
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload frmSet
Unload frmAbout
Unload frmMain
Unload frmAcount
End Sub
Private Sub txtUserName_Click()
On Error Resume Next
SaveSetting App.EXEName, "Option", "UserID", txtUserName.ListIndex
txtPassword.SetFocus
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -