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

📄 frmpassword0.frm

📁 用于控制氧乐果生产的程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmPassword 
   Caption         =   "用户密码窗口"
   ClientHeight    =   2148
   ClientLeft      =   48
   ClientTop       =   336
   ClientWidth     =   3804
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2148
   ScaleWidth      =   3804
   StartUpPosition =   2  'CenterScreen
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   "D:\ylg\csdata\user.mdb"
      DefaultCursorType=   0  'DefaultCursor
      DefaultType     =   2  'UseODBC
      Exclusive       =   0   'False
      Height          =   324
      Left            =   0
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "user"
      Top             =   1920
      Visible         =   0   'False
      Width           =   912
   End
   Begin VB.TextBox txtName 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      IMEMode         =   3  'DISABLE
      Left            =   1800
      TabIndex        =   0
      Top             =   240
      Width           =   1692
   End
   Begin VB.CommandButton Command2 
      Cancel          =   -1  'True
      Caption         =   "取消&C"
      Height          =   340
      Left            =   2280
      MouseIcon       =   "frmPassword.frx":0000
      MousePointer    =   99  'Custom
      TabIndex        =   3
      Top             =   1560
      Width           =   800
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定&O"
      Height          =   340
      Left            =   720
      MouseIcon       =   "frmPassword.frx":0152
      MousePointer    =   99  'Custom
      TabIndex        =   2
      Top             =   1560
      Width           =   800
   End
   Begin VB.TextBox txtPassword 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   372
      IMEMode         =   3  'DISABLE
      Left            =   1800
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   960
      Width           =   1692
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "请输入用户名:"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   240
      TabIndex        =   5
      Top             =   306
      Width           =   1680
   End
   Begin VB.Image Image1 
      BorderStyle     =   1  'Fixed Single
      Height          =   2124
      Left            =   24
      Top             =   0
      Width           =   3768
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "请输入密码:"
      BeginProperty Font 
         Name            =   "隶书"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   240
      TabIndex        =   4
      Top             =   1032
      Width           =   1440
   End
End
Attribute VB_Name = "frmPassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Option Compare Text
Private mintEventChar As String

Private Sub Command1_Click()
Call PassWord(Me.EventChar)
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Public Property Get EventChar() As String
    EventChar = mintEventChar
End Property

Public Property Let EventChar(ByVal vData As String)
    mintEventChar = vData
End Property

Private Sub Form_Unload(Cancel As Integer)
Data1.Recordset.Close
End Sub

Private Sub txtName_GotFocus()
Call GotFocusAgain(txtName)
End Sub

Private Sub txtName_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = vbKeyReturn Then txtPassword.SetFocus
End Sub

Private Sub txtPassword_GotFocus()
Call GotFocusAgain(txtPassword)
End Sub

Private Sub txtPassword_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
If KeyCode = vbKeyReturn Then Call PassWord(Me.EventChar)
End Sub
Private Sub PassWord(ByVal strEvent As String)
Dim i, RecNum As Integer
Dim PauseKaiDu(1 To 3) As Single
With Data1.Recordset
    .OpenRecordset
    .FindFirst "name='" & txtName.Text & "'"
End With
If Data1.Recordset.NoMatch Then
    Call Inform(31)
    txtName.SetFocus
Else
    If txtPassword.Text = Data1.Recordset.Fields("password") Then
    gstrUserName = txtName.Text
    gstrUserType = Data1.Recordset.Fields("type")
    Unload frmPassword
    Select Case Me.EventChar
        Case "mainfrm.show"
            gstrCaoZuo = "进入系统"
            mainfrm.Show
            Call WriteBlackBox
        Case "update canshu"
            If gstrUserType <> "管理员" Then
                Call Inform(33)
            Else
                With frmCanShu
                    .Updatable = True
                    gstrCaoZuo = "修改参数"
                    Call WriteBlackBox
                    For i = 0 To 3
                        .dbg1(i).AllowUpdate = True
                    Next
                    .cmdOK.Enabled = True
                End With
            End If
        Case "fyf1touliao"
            gstrCaoZuo = "1#釜建立反应"
            With fyftlfrm
                .Index = 1
                .Show vbModal
            End With
        Case "fyf2touliao"
            gstrCaoZuo = "2#釜建立反应"
            With fyftlfrm
                .Index = 2
                .Show vbModal
            End With
        Case "fyf3touliao"
            gstrCaoZuo = "3#釜建立反应"
            With fyftlfrm
                .Index = 3
                .Show vbModal
            End With
        Case "fyf1xiuzheng"
            gstrCaoZuo = "1#釜修正投料"
            With fyftlfrm
                .IsZhuiJia = True
                .Index = 1
                .Label1.Caption = "请输入精酯修正量(kg):"
                .Show vbModal
            End With
        Case "fyf2xiuzheng"
            gstrCaoZuo = "2#釜修正投料"
            With fyftlfrm
                .Show vbModal
                .IsZhuiJia = True
                .Index = 2
                .Label1.Caption = "请输入精酯修正量"
            End With
        Case "fyf3xiuzheng"
            gstrCaoZuo = "3#釜修正投料"
            With fyftlfrm
                .Show vbModal
                .IsZhuiJia = True
                .Index = 3
                .Label1.Caption = "请输入精酯修正量"
            End With
        Case "fyf1chuliang"
            gstrCaoZuo = "输入一号釜反应结果信息"
            With frmChuLiang
                .fyfNum = 1
                .Show vbModal
            End With
        Case "fyf2chuliang"
            gstrCaoZuo = "输入二号釜反应结果信息"
            With frmChuLiang
                .fyfNum = 2
                .Show vbModal
            End With
        Case "fyf3chuliang"
            gstrCaoZuo = "输入三号釜反应结果信息"
            With frmChuLiang
                .fyfNum = 3
                .Show vbModal
            End With
        Case "fyf1pause"
            gstrCaoZuo = "1#反应釜暂停反应"
            With mainfrm.fyf1_Control
                PauseKaiDu(1) = .tlfaKaiDu
                Call A_out(.tlfBaseAddress, .tlfChannel, 0)
                gIsTouLiao(1) = False
            End With
            Call WriteBlackBox
        Case "fyf1goon"
            gstrCaoZuo = "1#反应釜继续反应"
            With mainfrm.fyf1_Control
                Call A_out(.tlfBaseAddress, .tlfChannel, PauseKaiDu(1))
                gIsTouLiao(1) = True
            End With
            Call WriteBlackBox
        Case "fyf1stop"
            gstrCaoZuo = "1#反应釜异常终止"
            With mainfrm.fyf1_Control
                Call A_out(.tlfBaseAddress, .tlfChannel, 0)
                .WorkState = False
                gIsTouLiao(1) = False
            End With
            Call WriteBlackBox
        Case "resume1"
            gstrCaoZuo = "1#反应釜恢复反应"
            With Batchlsrs(1)
                .MoveLast
                mainfrm.fyf1_Control.jlgcsYeWei = .Fields("chushiyewei")
                mainfrm.fyf1_Control.jlgjsYeWei = .Fields("jieshuyewei")
            End With
            With mainfrm.fyf1_Control
                If gblnIsAuto(1) Then Call A_out(.tlfBaseAddress, .tlfChannel, 100)
                .WorkState = True
                mainfrm.tmrControl(0).Enabled = True
            End With
            Call WriteBlackBox
        Case "fyf2pause"
            gstrCaoZuo = "2#反应釜暂停反应"
            With mainfrm.fyf2_Control
                PauseKaiDu(2) = .tlfaKaiDu
                Call A_out(.tlfBaseAddress, .tlfChannel, 0)
                gIsTouLiao(2) = False
            End With
            Call WriteBlackBox
        Case "fyf2goon"
            gstrCaoZuo = "2#反应釜继续反应"
            With mainfrm.fyf2_Control
                Call A_out(.tlfBaseAddress, .tlfChannel, PauseKaiDu(2))
                gIsTouLiao(2) = True
            End With
            Call WriteBlackBox
        Case "fyf2stop"
            gstrCaoZuo = "2#反应釜异常终止"
            With mainfrm.fyf2_Control
                Call A_out(.tlfBaseAddress, .tlfChannel, 0)
                .WorkState = False
                gIsTouLiao(2) = False
            End With
            Call WriteBlackBox
        Case "resume2"
            gstrCaoZuo = "2#反应釜恢复反应"
            With Batchlsrs(2)
                .MoveLast
                mainfrm.fyf2_Control.jlgcsYeWei = .Fields("chushiyewei")
                mainfrm.fyf2_Control.jlgjsYeWei = .Fields("jieshuyewei")
            End With
            With mainfrm.fyf2_Control
                If gblnIsAuto(2) Then Call A_out(.tlfBaseAddress, .tlfChannel, 100)
                .WorkState = True
                mainfrm.tmrControl(1).Enabled = True
            End With
            Call WriteBlackBox
        Case "fyf3pause"
            gstrCaoZuo = "3#反应釜暂停反应"
            With mainfrm.fyf3_Control
                PauseKaiDu(3) = .tlfaKaiDu
                Call A_out(.tlfBaseAddress, .tlfChannel, 0)
                gIsTouLiao(3) = False
            End With
            Call WriteBlackBox
        Case "fyf3goon"
            gstrCaoZuo = "3#反应釜继续反应"
            With mainfrm.fyf3_Control
                Call A_out(.tlfBaseAddress, .tlfChannel, PauseKaiDu(3))
                gIsTouLiao(3) = True
            End With
            Call WriteBlackBox
        Case "fyf3stop"
            gstrCaoZuo = "3#反应釜异常终止"
            With mainfrm.fyf3_Control
                Call A_out(.tlfBaseAddress, .tlfChannel, 0)
                .WorkState = False
                gIsTouLiao(3) = False
            End With
            Call WriteBlackBox
        Case "resume3"
            gstrCaoZuo = "3#反应釜恢复反应"
            With Batchlsrs(3)
                .MoveLast
                mainfrm.fyf3_Control.jlgcsYeWei = .Fields("chushiyewei")
                mainfrm.fyf3_Control.jlgjsYeWei = .Fields("jieshuyewei")
            End With
            With mainfrm.fyf3_Control
                If gblnIsAuto(3) Then Call A_out(.tlfBaseAddress, .tlfChannel, 100)
                .WorkState = True
                mainfrm.tmrControl(2).Enabled = True
            End With
            Call WriteBlackBox
        Case "addnewuser"
        If gstrUserType = "管理员" Or gstrUserType = "工程师" Then
            frmUser.mblnAllowAddnew = True
            gstrCaoZuo = "建立新用户"
            Call WriteBlackBox
            Call Inform(42)
        Else
            Call Inform(33)
        End If
        Case "changeuser"
        If gstrUserType = "管理员" Or gstrUserType = "工程师" Then
            frmUser.mblnAllowChange = True
            gstrCaoZuo = "修改用户名或密码"
            Call WriteBlackBox
            Call Inform(42)
        Else
            Call Inform(33)
        End If
        Case "deleteuser"
        If gstrUserType = "管理员" Or gstrUserType = "工程师" Then
            frmUser.mblnAllowDelete = True
            gstrCaoZuo = "删除用户"
            Call WriteBlackBox
        Else
            Call Inform(33)
        End If
        Case "delete record"
        If gstrUserType = "管理员" Then
            frmDBManage.gblnHaveRightDelete = True
            gstrCaoZuo = "删除" + frmDBManage.gstrDBName + "记录"
        Else
            Call Inform(33)
            frmDBManage.gblnHaveRightDelete = False
        End If
        Case "end"
            gstrCaoZuo = "退出系统"
            Call WriteBlackBox
            End
    End Select
    Else
        Call Inform(32)
        txtPassword.SetFocus
    End If
End If
End Sub

⌨️ 快捷键说明

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