⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmlogin.frm

📁 这是一个用vb 写的聊天室
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form frmLogin 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Amojeba Chat: Login"
   ClientHeight    =   4860
   ClientLeft      =   30
   ClientTop       =   330
   ClientWidth     =   6315
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4860
   ScaleWidth      =   6315
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame fraSettings 
      Caption         =   "Settings:"
      Height          =   1530
      Left            =   75
      TabIndex        =   7
      Top             =   3255
      Width           =   2820
      Begin VB.TextBox txtRPort 
         Height          =   285
         Left            =   105
         TabIndex        =   11
         Text            =   "9456"
         Top             =   1065
         Width           =   1170
      End
      Begin VB.TextBox txtRHost 
         Height          =   285
         Left            =   105
         TabIndex        =   10
         Top             =   465
         Width           =   2580
      End
      Begin VB.Label Label2 
         Caption         =   "Remote Port:"
         Height          =   195
         Left            =   120
         TabIndex        =   9
         Top             =   795
         Width           =   930
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "Remote Host:"
         Height          =   195
         Left            =   120
         TabIndex        =   8
         Top             =   255
         Width           =   975
      End
   End
   Begin VB.PictureBox Picture1 
      Height          =   3180
      Left            =   75
      Picture         =   "frmLogin.frx":030A
      ScaleHeight     =   208
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   409
      TabIndex        =   6
      Top             =   45
      Width           =   6195
   End
   Begin MSWinsockLib.Winsock sockUser 
      Left            =   3915
      Top             =   4950
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   393216
      RemoteHost      =   "0"
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "E&xit"
      Height          =   360
      Left            =   4470
      TabIndex        =   5
      Top             =   4440
      Width           =   852
   End
   Begin VB.CommandButton cmdLogin 
      Caption         =   "&Login"
      Height          =   360
      Left            =   5340
      TabIndex        =   4
      Top             =   4440
      Width           =   852
   End
   Begin VB.TextBox txtPass 
      Height          =   300
      IMEMode         =   3  'DISABLE
      Left            =   4230
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   3975
      Width           =   1950
   End
   Begin VB.TextBox txtName 
      Height          =   288
      Left            =   4230
      TabIndex        =   1
      Top             =   3540
      Width           =   1950
   End
   Begin VB.Label lblPass 
      AutoSize        =   -1  'True
      Caption         =   "Password:"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   11.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   270
      Left            =   2970
      TabIndex        =   2
      Top             =   3990
      Width           =   915
   End
   Begin VB.Label lblName 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Login Name:"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   11.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   2970
      TabIndex        =   0
      Top             =   3570
      Width           =   1140
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdExit_Click()
    Dim frmExit As Form                     ' Close ALL!!! Forms
        For Each frmExit In Forms           ' -^
            Unload frmExit                  ' --^
        Next frmExit                        ' ---^
End Sub

Private Sub cmdLogin_Click()
If sockUser.State <> sckClosed Then sockUser.Close
sockUser.RemoteHost = txtRHost          ' Tell the socket what the host is
sockUser.RemotePort = txtRPort          ' Tell the socket what the port number is
sockUser.Connect                        'Connect to the server
End Sub



Private Sub Form_Load()
    SignOff = 0         ' Make sure the program knows its loaded
End Sub

Private Sub sockUser_Close()
    MsgBox "The Connection to the server has been lost!", vbOKOnly, "-Erorr- Connection Error" ' Tell the user the sysop killed em or they lost connection some how
    sockUser.Close                                                                             ' Close the socket
    Dim frmShutDown As Form                                                                    ' Close all the forms
        For Each frmShutDown In Forms                                                          '
            Unload frmShutDown                                                                 '
        Next frmShutDown                                                                       ' ---^
    frmLogin.Show                                                                              ' Load the login form
End Sub

Private Sub sockUser_DataArrival(ByVal bytesTotal As Long)
Dim Getrecv As String, RecvCmd
Dim Thing, i, FCount
On Error GoTo enda
    sockUser.GetData Getrecv, vbString          'Get the text from the server
    FCount = 0                                  ' Checks how the message was sent!!
    For i = 1 To Len(Getrecv)                   ' Fix it if there was a problem
        If Mid(Getrecv, i, 1) = Chr(10) Then    '
            FCount = FCount + 1                 '
        End If                                  '
    Next i                                      ' --^
    If FCount >= 2 Then                             ' A few messages buched together, fix it and parse it
        For Each Thing In Split(Getrecv, Chr(10))   ' Parse it
            Call ParseRecv(Thing)                   '
        Next Thing                                  ' --^
    Else
        Call ParseRecv(Mid(Getrecv, 1, Len(Getrecv) - 1))   ' No problem, parse it
    End If
enda:
End Sub

Private Sub sockUser_SendComplete()
    If SignOff = 1 Then             ' When they sign off, check to see if they wanted to
        Dim frm As Form             ' if they did, close all the forms
        For Each frm In Forms
            Unload frm
        Next frm
    End If
End Sub

Private Sub txtName_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then                                   ' When they press enter to go to the next field
        If txtName.Text = "" Then                           ' Check to make sure they typed something
            MsgBox "You must type in a login name first"    ' If not remind them
            txtName.SetFocus                                ' make it easier on them
        Else
            txtPass.SetFocus                                ' If they did type something send em to the next box
        End If
        KeyAscii = 0                                        ' Kill the beep
    End If
End Sub

Private Sub txtPass_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then                                   ' Just like above except with the pass box
        If txtPass.Text = "" Then
            MsgBox "You have to type in a password first"
            txtPass.SetFocus
        Else
            cmdLogin_Click                                  ' They filled everything out.. let em connect
        End If
        KeyAscii = 0
    End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -