www.pudn.com > renshixitong.rar > frmLogin.frm


VERSION 5.00 
Begin VB.Form frmLogin  
   BorderStyle     =   3  'Fixed Dialog 
   Caption         =   "Login" 
   ClientHeight    =   2976 
   ClientLeft      =   36 
   ClientTop       =   336 
   ClientWidth     =   4656 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   2976 
   ScaleWidth      =   4656 
   ShowInTaskbar   =   0   'False 
   StartUpPosition =   2  'CenterScreen 
   Tag             =   "Login" 
   Begin VB.CommandButton cmdCancel  
      Cancel          =   -1  'True 
      Caption         =   "Cancel" 
      Height          =   360 
      Left            =   2340 
      TabIndex        =   5 
      Tag             =   "Cancel" 
      Top             =   1944 
      Width           =   1140 
   End 
   Begin VB.CommandButton cmdOK  
      Caption         =   "OK" 
      Default         =   -1  'True 
      Height          =   360 
      Left            =   732 
      TabIndex        =   4 
      Tag             =   "OK" 
      Top             =   1944 
      Width           =   1140 
   End 
   Begin VB.TextBox txtPassword  
      Height          =   288 
      IMEMode         =   3  'DISABLE 
      Left            =   1548 
      PasswordChar    =   "*" 
      TabIndex        =   1 
      Top             =   1452 
      Width           =   2325 
   End 
   Begin VB.TextBox txtUserName  
      Height          =   288 
      Left            =   1548 
      TabIndex        =   3 
      Top             =   1056 
      Width           =   2325 
   End 
   Begin VB.Label Label1  
      BackColor       =   &H80000000& 
      Caption         =   "企业人事管理信息系统" 
      BeginProperty Font  
         Name            =   "华文彩云" 
         Size            =   18 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H80000001& 
      Height          =   492 
      Left            =   360 
      TabIndex        =   6 
      Top             =   240 
      Width           =   3852 
   End 
   Begin VB.Label lblLabels  
      Caption         =   "密码" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.8 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   252 
      Index           =   1 
      Left            =   348 
      TabIndex        =   0 
      Tag             =   "&Password:" 
      Top             =   1464 
      Width           =   1080 
   End 
   Begin VB.Label lblLabels  
      Caption         =   "用户名:" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   10.8 
         Charset         =   0 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   252 
      Index           =   0 
      Left            =   348 
      TabIndex        =   2 
      Tag             =   "&User Name:" 
      Top             =   1080 
      Width           =   1080 
   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 
 
 
    sBuffer = Space$(255) 
    lSize = Len(sBuffer) 
    Call GetUserName(sBuffer, lSize) 
    If lSize > 0 Then 
        txtUserName.Text = "" 
    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