📄 frmlogin.frm
字号:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 4 'Fixed ToolWindow
Caption = "Login"
ClientHeight = 1575
ClientLeft = 45
ClientTop = 315
ClientWidth = 3735
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 1575
ScaleWidth = 3735
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Tag = "1052"
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 360
Left = 2100
Style = 1 'Graphical
TabIndex = 5
Tag = "1056"
Top = 1020
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
Height = 360
Left = 495
Style = 1 'Graphical
TabIndex = 4
Tag = "1055"
Top = 1020
Width = 1140
End
Begin VB.TextBox txtPassword
BackColor = &H8000000F&
Height = 285
IMEMode = 3 'DISABLE
Left = 1305
PasswordChar = "*"
TabIndex = 1
Top = 525
Width = 2325
End
Begin VB.TextBox txtUserName
BackColor = &H8000000F&
Height = 285
Left = 1305
TabIndex = 3
Top = 135
Width = 2325
End
Begin VB.Label lblLabels
Caption = "密码:"
Height = 255
Index = 1
Left = 240
TabIndex = 0
Tag = "1054"
Top = 555
Width = 600
End
Begin VB.Label lblLabels
Caption = "用户名:"
Height = 255
Index = 0
Left = 225
TabIndex = 2
Tag = "1053"
Top = 165
Width = 720
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Public OK As Boolean
Private Sub Form_Load()
Dim sBuffer As String
Dim lSize As Long
LoadResStrings Me
sBuffer = Space$(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
If lSize > 0 Then
txtUserName.Text = Left$(sBuffer, lSize)
Else
txtUserName.Text = vbNullString
End If
End Sub
Private Sub cmdCancel_Click()
OK = False
Me.Hide
End Sub
Private Sub cmdOK_Click()
'ToDo: create test for correct password
'check for correct password
If txtPassword.Text = "" Then
OK = True
Me.Hide
Else
MsgBox "Invalid Password, try again!", , "Login"
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -