frmLogin.frm
上传用户:fulizhu2
上传日期:2007-06-21
资源大小:34k
文件大小:4k
源码类别:

酒店行业

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form frmLogin 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Login"
  5.    ClientHeight    =   3024
  6.    ClientLeft      =   36
  7.    ClientTop       =   336
  8.    ClientWidth     =   4944
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   3024
  13.    ScaleWidth      =   4944
  14.    ShowInTaskbar   =   0   'False
  15.    StartUpPosition =   2  'CenterScreen
  16.    Tag             =   "Login"
  17.    Begin VB.CommandButton cmdCancel 
  18.       Cancel          =   -1  'True
  19.       Caption         =   "Cancel"
  20.       Height          =   360
  21.       Left            =   2580
  22.       TabIndex        =   5
  23.       Tag             =   "Cancel"
  24.       Top             =   2340
  25.       Width           =   1140
  26.    End
  27.    Begin VB.CommandButton cmdOK 
  28.       Caption         =   "OK"
  29.       Default         =   -1  'True
  30.       Height          =   360
  31.       Left            =   972
  32.       TabIndex        =   4
  33.       Tag             =   "OK"
  34.       Top             =   2340
  35.       Width           =   1140
  36.    End
  37.    Begin VB.TextBox txtPassword 
  38.       Height          =   288
  39.       IMEMode         =   3  'DISABLE
  40.       Left            =   1788
  41.       PasswordChar    =   "*"
  42.       TabIndex        =   1
  43.       Top             =   1848
  44.       Width           =   2325
  45.    End
  46.    Begin VB.TextBox txtUserName 
  47.       Height          =   288
  48.       Left            =   1788
  49.       TabIndex        =   3
  50.       Top             =   1452
  51.       Width           =   2325
  52.    End
  53.    Begin VB.Label Label1 
  54.       Caption         =   "宾馆管理信息系统"
  55.       BeginProperty Font 
  56.          Name            =   "华文彩云"
  57.          Size            =   24
  58.          Charset         =   134
  59.          Weight          =   700
  60.          Underline       =   0   'False
  61.          Italic          =   0   'False
  62.          Strikethrough   =   0   'False
  63.       EndProperty
  64.       ForeColor       =   &H80000001&
  65.       Height          =   612
  66.       Left            =   480
  67.       TabIndex        =   6
  68.       Top             =   360
  69.       Width           =   4092
  70.    End
  71.    Begin VB.Label lblLabels 
  72.       Caption         =   "密  码:"
  73.       BeginProperty Font 
  74.          Name            =   "宋体"
  75.          Size            =   10.8
  76.          Charset         =   0
  77.          Weight          =   700
  78.          Underline       =   0   'False
  79.          Italic          =   0   'False
  80.          Strikethrough   =   0   'False
  81.       EndProperty
  82.       Height          =   252
  83.       Index           =   1
  84.       Left            =   600
  85.       TabIndex        =   0
  86.       Tag             =   "&Password:"
  87.       Top             =   1860
  88.       Width           =   840
  89.    End
  90.    Begin VB.Label lblLabels 
  91.       Caption         =   "用户名:"
  92.       BeginProperty Font 
  93.          Name            =   "宋体"
  94.          Size            =   10.8
  95.          Charset         =   0
  96.          Weight          =   700
  97.          Underline       =   0   'False
  98.          Italic          =   0   'False
  99.          Strikethrough   =   0   'False
  100.       EndProperty
  101.       Height          =   252
  102.       Index           =   0
  103.       Left            =   588
  104.       TabIndex        =   2
  105.       Tag             =   "&User Name:"
  106.       Top             =   1476
  107.       Width           =   1080
  108.    End
  109. End
  110. Attribute VB_Name = "frmLogin"
  111. Attribute VB_GlobalNameSpace = False
  112. Attribute VB_Creatable = False
  113. Attribute VB_PredeclaredId = True
  114. Attribute VB_Exposed = False
  115. Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
  116. Public OK As Boolean
  117. Private Sub Form_Load()
  118.     Dim sBuffer As String
  119.     Dim lSize As Long
  120.     sBuffer = Space$(255)
  121.     lSize = Len(sBuffer)
  122.     Call GetUserName(sBuffer, lSize)
  123.     If lSize > 0 Then
  124.         txtUserName.Text = Left$(sBuffer, lSize)
  125.     Else
  126.         txtUserName.Text = vbNullString
  127.     End If
  128. End Sub
  129. Private Sub cmdCancel_Click()
  130.     OK = False
  131.     Me.Hide
  132. End Sub
  133. Private Sub cmdOK_Click()
  134.     'ToDo: create test for correct password
  135.     'check for correct password
  136.     If txtPassword.Text = "" Then
  137.         OK = True
  138.         Me.Hide
  139.     Else
  140.         MsgBox "Invalid Password, try again!", , "Login"
  141.         txtPassword.SetFocus
  142.         txtPassword.SelStart = 0
  143.         txtPassword.SelLength = Len(txtPassword.Text)
  144.     End If
  145. End Sub