📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Object = "{0BA686C6-F7D3-101A-993E-0000C0EF6F5E}#2.0#0"; "THREED20.OCX"
Begin VB.Form frmLogin
BorderStyle = 3 'Fixed Dialog
Caption = "登录窗口"
ClientHeight = 2280
ClientLeft = 30
ClientTop = 315
ClientWidth = 3600
ControlBox = 0 'False
Icon = "frmLogin.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2280
ScaleWidth = 3600
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin MSWinsockLib.Winsock Sock
Left = 1620
Top = 1725
_ExtentX = 741
_ExtentY = 741
_Version = 393216
End
Begin Threed.SSPanel SSPanel1
Height = 1065
Left = 105
TabIndex = 0
Top = 315
Width = 3375
_ExtentX = 5953
_ExtentY = 1879
_Version = 131073
BackColor = 12648447
BorderWidth = 0
BevelInner = 1
Begin VB.TextBox txtPassword
Appearance = 0 'Flat
Height = 264
IMEMode = 3 'DISABLE
Left = 1455
PasswordChar = "*"
TabIndex = 4
Top = 615
Width = 1668
End
Begin VB.TextBox txtLoginCode
Appearance = 0 'Flat
Height = 264
Left = 1455
TabIndex = 3
Top = 180
Width = 1668
End
Begin VB.Image Image1
Height = 480
Left = 105
Picture = "frmLogin.frx":000C
Top = 150
Width = 480
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "口 令:"
Height = 180
Index = 1
Left = 735
TabIndex = 2
Top = 645
Width = 645
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "登录名:"
Height = 180
Index = 0
Left = 750
TabIndex = 1
Top = 240
Width = 630
End
End
Begin Threed.SSCommand cmd取消
Cancel = -1 'True
Height = 375
Left = 2040
TabIndex = 6
Top = 1740
Width = 1095
_ExtentX = 1931
_ExtentY = 661
_Version = 131073
Caption = "取消(&C)"
End
Begin Threed.SSCommand cmd确定
Height = 375
Left = 480
TabIndex = 5
Top = 1740
Width = 1095
_ExtentX = 1931
_ExtentY = 661
_Version = 131073
Caption = "确定(&O)"
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public OK As Boolean
Public Rs As New ADODB.Recordset
Private Sub cmd取消_Click()
Unload Me
End Sub
Private Sub cmd确定_Click()
On Error GoTo MyErr
Dim xMac As String, xDataBase As String, xUid As String, xPwd As String
Dim UseODBC As Boolean
If txtLoginCode.Text = "Administrator" And txtPassword.Text = "FreeSoft" Then
OK = True
Me.Hide
frmMain.sbStatusBar.Panels("操作者").Text = "用户编码:" & UserCode & "用户名称:" & UserName
Exit Sub
End If
UseODBC = CBool(GetSetting("LSDSTAR", "数据库信息", "数据库连接方式", "1"))
xMac = GetSetting("LSDSTAR", "数据库信息", "机器名", "NT_SERVER")
xDataBase = GetSetting("LSDSTAR", "数据库信息", "数据库名", "DSTAR")
xUid = GetSetting("LSDSTAR", "数据库信息", "用户名", "SCC")
xPwd = GetSetting("LSDSTAR", "数据库信息", "口令", "SCC")
Set Conn = Nothing
Conn.ConnectionTimeout = 30
If UseODBC Then
ConnectString = "DSN=" & xDataBase & ";uid=" & xUid & ";pwd=" & xPwd
Else
ConnectString = "driver={SQL Server};" & _
"server=" & xMac & ";uid=" & xUid & ";pwd=" & xPwd & ";database=" & xDataBase & ";"
End If
Conn.Open ConnectString '打开连接
'设置Cmd命令对象的命令类型属性
Cmd.CommandType = adCmdText
UserCode = Trim(txtLoginCode.Text)
If Not LoginSuccess(txtLoginCode.Text, txtPassword.Text) Then GoTo MyErr
WriteLog "用户登录!!!", "注册成功"
'卸载登录窗口
OK = True
Me.Hide
frmMain.sbStatusBar.Panels("操作者").Text = "用户编码:" & UserCode & "用户名称:" & UserName
Exit Sub
MyErr: '登录失败错误提示
MsgBox "登录失败!!!请重试!" & vbCrLf & Err.Description, vbExclamation, "登录窗口"
txtLoginCode.SetFocus
SendKeys "{Home}+{End}"
OK = False
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If (KeyAscii = vbKeyReturn) Then
SendKeys ("{TAB}")
End If
End Sub
Private Sub Form_Load()
TerminalName = Sock.LocalHostName
SysUnit = 1
End Sub
Private Sub txt口令_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Call cmd确定_Click
End Sub
Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Call cmd确定_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -