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

📄 frmlogin.frm

📁 一个网带烧结炉的程序,串口通讯,做工业自动化的可以参考
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmLogin 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "登录"
   ClientHeight    =   5055
   ClientLeft      =   4650
   ClientTop       =   3000
   ClientWidth     =   5745
   Icon            =   "frmLogin.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   2986.661
   ScaleMode       =   0  'User
   ScaleWidth      =   5394.245
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame2 
      Caption         =   "操作员组"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3615
      Left            =   4920
      TabIndex        =   5
      Top             =   480
      Visible         =   0   'False
      Width           =   3975
      Begin VB.CommandButton Command2 
         Caption         =   "登录"
         Default         =   -1  'True
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   1440
         TabIndex        =   11
         Top             =   2880
         Width           =   1140
      End
      Begin VB.ComboBox Combo2 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         Left            =   1440
         Style           =   2  'Dropdown List
         TabIndex        =   7
         Top             =   360
         Width           =   2295
      End
      Begin VB.TextBox Text2 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   435
         IMEMode         =   3  'DISABLE
         Left            =   1440
         PasswordChar    =   "*"
         TabIndex        =   6
         Top             =   2040
         Width           =   2325
      End
      Begin VB.Label lblLabels 
         Caption         =   "用户名"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   270
         Index           =   1
         Left            =   360
         TabIndex        =   9
         Top             =   480
         Width           =   1080
      End
      Begin VB.Label lblLabels 
         Caption         =   "密码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   270
         Index           =   0
         Left            =   360
         TabIndex        =   8
         Top             =   2160
         Width           =   1080
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "管理员组"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   3615
      Left            =   870
      TabIndex        =   0
      Top             =   510
      Width           =   3975
      Begin VB.CommandButton cmdCancel 
         Cancel          =   -1  'True
         Caption         =   "取消"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   420
         Left            =   2370
         TabIndex        =   12
         Top             =   2910
         Width           =   1140
      End
      Begin VB.CommandButton Command1 
         Caption         =   "登录"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   420
         Left            =   480
         TabIndex        =   10
         Top             =   2910
         Width           =   1140
      End
      Begin VB.TextBox Text1 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   435
         IMEMode         =   3  'DISABLE
         Left            =   1440
         PasswordChar    =   "*"
         TabIndex        =   4
         Top             =   2040
         Width           =   2325
      End
      Begin VB.ComboBox Combo1 
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   405
         Left            =   1440
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   360
         Width           =   2295
      End
      Begin VB.Label lblLabels 
         Caption         =   "密码"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   270
         Index           =   3
         Left            =   360
         TabIndex        =   3
         Top             =   2160
         Width           =   1080
      End
      Begin VB.Label lblLabels 
         Caption         =   "用户名"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   14.25
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   270
         Index           =   2
         Left            =   360
         TabIndex        =   2
         Top             =   480
         Width           =   1080
      End
   End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit



Private Sub cmdCancel_Click()
    '设置全局变量为 false
    '不提示失败的登录
    LoginSucceeded = 0
    Unload Me
End Sub



Private Sub Command1_Click()
    mainuser(9).password = "123456"
    mainuser(9).dj = 1
    On Error GoTo 1
    If mainuser(Combo1.ListIndex).password <> Text1 Then
        MsgBox "无效的密码,请重试!", , "登录"
        
        Text1.SetFocus
        SendKeys "{Home}+{End}"
    Else
        LoginSucceeded = True
        curuser = mainuser(Combo1.ListIndex)
        
        Unload Me
        
    End If
1:
End Sub

Private Sub Command2_Click()
On Error GoTo 1
If ptuser(Combo2.ListIndex).password = Text2 Then
        LoginSucceeded = True
        curuser = ptuser(Combo2.ListIndex)

        Unload Me
    Else
        
        MsgBox "无效的密码,请重试!", , "登录"
        
        Text2.SetFocus
        SendKeys "{Home}+{End}"
    End If
1:
End Sub

Private Sub Form_Load()
Dim i As Integer
'SetTopMostWindow hwnd, True
Open App.Path + "\abc.pss" For Random As #1
For i = 0 To 8
Get #1, , mainuser(i)
Get #1, , ptuser(i)
Next i
Close #1
End Sub

Private Sub Form_Paint()
Dim i As Integer
For i = 0 To 8
    Combo1.List(i) = mainuser(i).username '管理员组列表
    Combo2.List(i) = ptuser(i).username '操作员组列表
Next i
Combo1.List(9) = "恒力"
End Sub

⌨️ 快捷键说明

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