home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / abrows1a / frmlogin.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-07-22  |  3.8 KB  |  125 lines

  1. VERSION 5.00
  2. Begin VB.Form frmLogin 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Andrew's Web Browser : Login"
  5.    ClientHeight    =   1590
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   3750
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   1590
  13.    ScaleWidth      =   3750
  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            =   2100
  22.       TabIndex        =   5
  23.       Tag             =   "Cancel"
  24.       Top             =   1020
  25.       Width           =   1140
  26.    End
  27.    Begin VB.CommandButton cmdOK 
  28.       Caption         =   "OK"
  29.       Default         =   -1  'True
  30.       Height          =   360
  31.       Left            =   495
  32.       TabIndex        =   4
  33.       Tag             =   "OK"
  34.       Top             =   1020
  35.       Width           =   1140
  36.    End
  37.    Begin VB.TextBox txtPassword 
  38.       Height          =   285
  39.       IMEMode         =   3  'DISABLE
  40.       Left            =   1305
  41.       PasswordChar    =   "*"
  42.       TabIndex        =   1
  43.       Top             =   525
  44.       Width           =   2325
  45.    End
  46.    Begin VB.TextBox txtUserName 
  47.       Height          =   285
  48.       Left            =   1305
  49.       TabIndex        =   3
  50.       Top             =   135
  51.       Width           =   2325
  52.    End
  53.    Begin VB.Label lblLabels 
  54.       Caption         =   "&Password:"
  55.       BeginProperty Font 
  56.          Name            =   "Comic Sans MS"
  57.          Size            =   8.25
  58.          Charset         =   0
  59.          Weight          =   400
  60.          Underline       =   0   'False
  61.          Italic          =   0   'False
  62.          Strikethrough   =   0   'False
  63.       EndProperty
  64.       Height          =   248
  65.       Index           =   1
  66.       Left            =   105
  67.       TabIndex        =   0
  68.       Tag             =   "&Password:"
  69.       Top             =   540
  70.       Width           =   1080
  71.    End
  72.    Begin VB.Label lblLabels 
  73.       Caption         =   "&User Name:"
  74.       BeginProperty Font 
  75.          Name            =   "Comic Sans MS"
  76.          Size            =   8.25
  77.          Charset         =   0
  78.          Weight          =   400
  79.          Underline       =   0   'False
  80.          Italic          =   0   'False
  81.          Strikethrough   =   0   'False
  82.       EndProperty
  83.       Height          =   248
  84.       Index           =   0
  85.       Left            =   105
  86.       TabIndex        =   2
  87.       Tag             =   "&User Name:"
  88.       Top             =   150
  89.       Width           =   1080
  90.    End
  91. Attribute VB_Name = "frmLogin"
  92. Attribute VB_GlobalNameSpace = False
  93. Attribute VB_Creatable = False
  94. Attribute VB_PredeclaredId = True
  95. Attribute VB_Exposed = False
  96. Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
  97. Public OK As Boolean
  98. Private Sub Form_Load()
  99.     Dim sBuffer As String
  100.     Dim lSize As Long
  101.     sBuffer = Space$(255)
  102.     lSize = Len(sBuffer)
  103.     Call GetUserName(sBuffer, lSize)
  104.     If lSize > 0 Then
  105.         txtUserName.Text = Left$(sBuffer, lSize)
  106.     Else
  107.         txtUserName.Text = vbNullString
  108.     End If
  109. End Sub
  110. Private Sub cmdCancel_Click()
  111.     OK = False
  112.     Me.Hide
  113. End Sub
  114. Private Sub cmdOK_Click()
  115.     If txtPassword.Text = "password" Then
  116.         OK = True
  117.         Me.Hide
  118.     Else
  119.         MsgBox "Invalid Password, so, stop crying about it and try again!", , "Login"
  120.         txtPassword.SetFocus
  121.         txtPassword.SelStart = 0
  122.         txtPassword.SelLength = Len(txtPassword.Text)
  123.     End If
  124. End Sub
  125.