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

📄 登录.frm

📁 一个VB编写的校园即时广播系统,具有简单的定时广播性能
💻 FRM
字号:
VERSION 5.00
Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
Begin VB.Form Login 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "校园及时通--登录"
   ClientHeight    =   2745
   ClientLeft      =   3285
   ClientTop       =   2355
   ClientWidth     =   3900
   ClipControls    =   0   'False
   Icon            =   "登录.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Picture         =   "登录.frx":000C
   ScaleHeight     =   1621.836
   ScaleMode       =   0  'User
   ScaleWidth      =   3661.89
   Begin MSWinsockLib.Winsock Listen_IP 
      Left            =   3435
      Top             =   750
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   327681
      Protocol        =   1
   End
   Begin VB.CheckBox nm 
      Alignment       =   1  'Right Justify
      Caption         =   "过客登录(&N)"
      Height          =   960
      Left            =   3435
      Style           =   1  'Graphical
      TabIndex        =   9
      ToolTipText     =   "过客不需要密码,但有功能限制"
      Top             =   1875
      Width           =   540
   End
   Begin VB.TextBox Mainadd 
      BackColor       =   &H8000000F&
      Height          =   300
      Left            =   1485
      TabIndex        =   2
      ToolTipText     =   "主机所在的IP地址,系统自动获得"
      Top             =   1230
      Width           =   1530
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消>>"
      Height          =   345
      Left            =   2040
      TabIndex        =   4
      ToolTipText     =   "退出"
      Top             =   2445
      Width           =   1470
   End
   Begin VB.ComboBox UserName 
      Height          =   300
      ItemData        =   "登录.frx":0984
      Left            =   1485
      List            =   "登录.frx":0986
      TabIndex        =   0
      ToolTipText     =   "填写登录名"
      Top             =   474
      Width           =   1530
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   50
      Left            =   3270
      Top             =   -15
   End
   Begin VB.TextBox pas 
      Height          =   300
      IMEMode         =   3  'DISABLE
      Left            =   1485
      MaxLength       =   8
      PasswordChar    =   "*"
      TabIndex        =   1
      ToolTipText     =   "填写你的密码"
      Top             =   855
      Width           =   1530
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "登录>>"
      Height          =   345
      Left            =   600
      TabIndex        =   3
      ToolTipText     =   "登录服务器"
      Top             =   2445
      Width           =   1500
   End
   Begin VB.Label Label3 
      Caption         =   "在用户名中,填入网管分配给你的用户名,如果你没修改密码系统默认为:12345678"
      Height          =   525
      Left            =   795
      TabIndex        =   10
      Top             =   1575
      Width           =   2670
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "主机地址:"
      Height          =   180
      Left            =   675
      TabIndex        =   8
      Top             =   1245
      Width           =   810
   End
   Begin VB.Label lblLabels 
      AutoSize        =   -1  'True
      Caption         =   "用户名:"
      Height          =   180
      Index           =   0
      Left            =   855
      TabIndex        =   7
      Top             =   555
      Width           =   630
   End
   Begin VB.Label Myip 
      AutoSize        =   -1  'True
      Caption         =   "Label2"
      Height          =   180
      Left            =   810
      TabIndex        =   6
      ToolTipText     =   "双击获得本地IP"
      Top             =   135
      Width           =   540
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "密码:"
      Height          =   180
      Left            =   1050
      TabIndex        =   5
      Top             =   885
      Width           =   450
   End
End
Attribute VB_Name = "Login"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim up As Boolean, qq As Boolean
Dim Errortimes As Integer
Dim Firstuser As String, Secdeuser As String, Passwords As String

Private Sub cmdCancel_Click()
Unload Form1
Unload Me
End Sub

Private Sub Cmdok_Click()     '有可能会出现错误  没找到主机的路由器  原因是IP地址不对
On Error GoTo runerr
If UserName.Text = "" Then MsgBox "请输入您的用户名", vbOKOnly + vbInformation, "错误": UserName.SetFocus: Exit Sub
If Len(Mainadd.Text) < 1 Then MsgBox "请输入服务器名或服务器IP地址", vbOKOnly + vbInformation, "错误": Mainadd.SetFocus: Exit Sub
If Firstuser <> UserName.Text And Secdeuser <> UserName.Text Then Secdeuser = Firstuser
With Form1
  If .ifNM = True Then
    .Locateuser = "过客" & UserName.Text
     .Passwords = "12345678"
  Else
     .Locateuser = UserName.Text
   .Passwords = pas.Text
  End If
.W1.Close
.W1.RemoteHost = Mainadd.Text
.W1.LocalPort = 0
.W1.Connect
End With
Me.Caption = "校园及时通-登录"
Timer1.Enabled = True
Exit Sub
runerr:
If Err.Number = 10065 Then MsgBox "请检查下服务器地址是否有误", vbOKOnly + vbCritical, "错误"
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
KeyCode = 0
Call Cmdok_Click
End If
End Sub

Private Sub Form_Load()
On Error Resume Next
Dim a As Integer
Me.Icon = Form1.P1(0).Picture
Myip.Caption = "本地IP → " & Form1.W1.LocalIP
With Listen_IP
.Protocol = sckUDPProtocol
'.RemoteHost = "222.222.222.222"   '指定为广播地址
.Bind 2019      '绑定本地IP PORT 为 2019
End With
Errortimes = 0           '设错误次数为 0
a = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "AutoRun")
Mainadd.Text = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "AutoFrisk")
Firstuser = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "LastUserName")
Secdeuser = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "LastUserName1")
If Not Firstuser = "" Then
UserName.Text = Firstuser
UserName.AddItem Firstuser
End If
If Secdeuser <> Firstuser Then UserName.AddItem Secdeuser
Mainadd.Text = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "LastMainADd")
If Not a = "0" Then
Form1.ifNM = True
Call Cmdok_Click
Else
Me.Show
End If
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If UnloadMode = 0 Then End
End Sub

Private Sub Listen_IP_DataArrival(ByVal bytesTotal As Long)
Dim IPadd As String
Listen_IP.GetData IPadd
Mainadd.Text = IPadd
End Sub

Private Sub Mainadd_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Call Cmdok_Click
End Sub

Private Sub Myip_DblClick()
Mainadd.Text = Mid(Myip.Caption, 8)
End Sub

Private Sub nm_LostFocus()
If nm.Value <> 0 Then Form1.ifNM = True Else Form1.ifNM = False
End Sub

Private Sub pas_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Call Cmdok_Click
End Sub

Private Sub Timer1_Timer()
On Error Resume Next
If Form1.W1.State = sckConnecting Then
If qq = True Then qq = False: Me.Caption = "校园及时通-) 登录 )" Else qq = True:  Me.Caption = "校园及时通-( 登录 ("
End If
If Form1.W1.State = sckConnected Then  '如果联接成功
Dim fipath As String
fipath = SavePath & "client.msg"
Call savestring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "LastUsername1", Secdeuser)
Call savestring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "LastUsername", UserName.Text)
Call savestring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "LastMainADd", Mainadd.Text)
 If Not getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "TalkRecoBackColor") = "" Then
With Form1
.add1.Text = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "AutoFrisk")
.ht.BackColor = getstring(HKEY_LOCAL_MACHINE, "Software\New Sun\Net Call", "TalkRecoBackColor")
  With .t1
        .BackColor = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "SendMagsageBackColor")
        .ForeColor = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "SendMagsageForeColor")
  End With
  .L1.BackColor = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "OnlinenameBackColor")
  .L1.ForeColor = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "OnlinenameForeColor")
 End With
 End If
With Form1
.Skin.SkinPath = SavePath
.Caption = .Locateuser & " 在校园及时通"
End With
If Dir(fipath) <> "" Then Form1.ht.LoadFile fipath, rtfRTF
Unload Me
End If
If Form1.W1.State = 1 Then Form1.W1.Close
If Form1.W1.State = sckError Then
    Beep
    If MsgBox("网络错误,是否尝试另一个主机地址", vbYesNo + vbQuestion, "错误") = vbYes Then
      If Errortimes = 10 And Me.Visible = True Then MsgBox "请重新设置一个服务器名或服务器 IP", vbOKOnly, "错误": Timer1.Enabled = False: Exit Sub Else MsgBox "请查实下网络是否联接或是你输入的服务器地址有误", vbOKOnly + vbQuestion, "请稍候再重试": Me.Visible = True
         Errortimes = Errortimes + 1  '错误次数加一
            Form1.W1.Close
              Mainadd.Text = getstring(HKEY_LOCAL_MACHINE, "software\New Sun\Net Call", "AutoFrisk")
              Dim f, s, t As Integer
              Dim NewAdd As String
s = InStr(Len(Mainadd.Text) - 3, Mainadd.Text, ".")
gofind:
    f = InStr(s, Mainadd.Text, ".")
    t = InStr(f + 1, Mainadd.Text, ".")
       If t <> 0 Then s = t: GoTo gofind Else f = s
                  NewAdd = Left(Mainadd.Text, f - 1) & "." & CStr(CInt(Right(Mainadd.Text, Len(Mainadd.Text) - f)) + Errortimes)
                   Mainadd.Text = NewAdd
                   Form1.W1.RemoteHost = NewAdd
                   Form1.W1.Connect
                   Me.Caption = "校园及时通--登录"
       End If
       Me.Caption = "校园及时通--登录"
       If Me.Visible = False Then Me.Visible = True
       Timer1.Enabled = False
End If
End Sub

Private Sub UserName_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then Call Cmdok_Click
End Sub

⌨️ 快捷键说明

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