?? frmlogin.frm
字號:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 0 'None
Caption = "登錄"
ClientHeight = 1590
ClientLeft = 0
ClientTop = -45
ClientWidth = 3750
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1590
ScaleWidth = 3750
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Tag = "登錄"
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "取消"
Height = 360
Left = 2115
TabIndex = 3
Tag = "取消"
Top = 1125
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "確定"
Default = -1 'True
Height = 360
Left = 510
TabIndex = 2
Tag = "確定"
Top = 1125
Width = 1140
End
Begin VB.TextBox txtPassword
Height = 270
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 1
Top = 630
Width = 2325
End
Begin VB.TextBox txtUserName
Height = 270
Left = 1320
TabIndex = 0
Top = 240
Width = 2325
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "密碼(&P):"
Height = 255
Index = 1
Left = 120
TabIndex = 5
Tag = "密碼(&P):"
Top = 645
Width = 1080
End
Begin VB.Label lblLabels
BackStyle = 0 'Transparent
Caption = "用戶名(&U):"
Height = 255
Index = 0
Left = 120
TabIndex = 4
Tag = "用戶名(&U):"
Top = 255
Width = 1080
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'***************************************************************************
http://www.codesky.net 源碼天空
'***************************************************************************
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
Me.BackColor = RGB(228, 228, 255)
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: 創建測試密碼是否正確
'檢查正確密碼
If txtPassword.Text = "123" Then
OK = True
Me.Hide
Else
MsgBox "密碼錯誤,再試一次!", , "登錄"
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
End If
End Sub
Private Sub Form_Resize()
txtPassword.SetFocus
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -