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

📄 frmserver.frm

📁 这是一本学习串口编程喝计算机监控的好书里面是用VB开发的源代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmServer 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Server Setup"
   ClientHeight    =   2910
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5400
   Icon            =   "frmServer.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   2910
   ScaleWidth      =   5400
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdRestore 
      Caption         =   "Restore"
      Height          =   375
      Left            =   4560
      TabIndex        =   22
      Top             =   600
      Width           =   735
   End
   Begin VB.TextBox txtLocation 
      BeginProperty DataFormat 
         Type            =   1
         Format          =   "0"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   2052
         SubFormatType   =   1
      EndProperty
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3480
      MaxLength       =   1
      TabIndex        =   20
      ToolTipText     =   "Feature Location"
      Top             =   2400
      Width           =   735
   End
   Begin VB.Frame Frame2 
      Caption         =   "Password Mode"
      Height          =   735
      Left            =   1800
      TabIndex        =   16
      Top             =   1080
      Width           =   3495
      Begin VB.OptionButton Optpwd 
         Caption         =   "---"
         Height          =   255
         Index           =   3
         Left            =   2760
         TabIndex        =   23
         Top             =   360
         Width           =   495
      End
      Begin VB.OptionButton Optpwd 
         Caption         =   "Date"
         Height          =   255
         Index           =   1
         Left            =   1050
         TabIndex        =   19
         Top             =   360
         Width           =   735
      End
      Begin VB.OptionButton Optpwd 
         Caption         =   "Normal"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   18
         Top             =   360
         Value           =   -1  'True
         Width           =   855
      End
      Begin VB.OptionButton Optpwd 
         Caption         =   "NoDate"
         Height          =   255
         Index           =   2
         Left            =   1800
         TabIndex        =   17
         Top             =   360
         Width           =   855
      End
   End
   Begin VB.TextBox txtSubCharSet 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1320
      TabIndex        =   14
      Top             =   1920
      Width           =   1095
   End
   Begin VB.TextBox txtSubFeature 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1320
      TabIndex        =   12
      Top             =   2400
      Width           =   1095
   End
   Begin VB.TextBox txtTimer 
      BeginProperty DataFormat 
         Type            =   1
         Format          =   "0"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   2052
         SubFormatType   =   1
      EndProperty
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   3480
      MaxLength       =   4
      TabIndex        =   10
      ToolTipText     =   "50-15000ms"
      Top             =   1920
      Width           =   735
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "Cancel"
      Height          =   375
      Left            =   4560
      TabIndex        =   8
      Top             =   1920
      Width           =   735
   End
   Begin VB.TextBox txtPort 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1440
      TabIndex        =   5
      Text            =   "110"
      ToolTipText     =   "110=POP3;  25=SMTP; 80=HTTP; 21=FTP"
      Top             =   600
      Width           =   1935
   End
   Begin VB.TextBox txtServer 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1440
      TabIndex        =   3
      Top             =   120
      Width           =   3855
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "OK"
      Default         =   -1  'True
      Height          =   375
      Left            =   4560
      TabIndex        =   1
      Top             =   2400
      Width           =   735
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "Save"
      Height          =   375
      Left            =   3600
      TabIndex        =   0
      Top             =   600
      Width           =   735
   End
   Begin VB.Frame Frame1 
      Caption         =   "Display Mode"
      Height          =   735
      Left            =   120
      TabIndex        =   6
      Top             =   1080
      Width           =   1575
      Begin VB.OptionButton optMode 
         Caption         =   "Hex"
         Height          =   255
         Index           =   1
         Left            =   840
         TabIndex        =   9
         Top             =   360
         Width           =   615
      End
      Begin VB.OptionButton optMode 
         Caption         =   "Char"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   7
         Top             =   360
         Value           =   -1  'True
         Width           =   735
      End
   End
   Begin VB.Label Label6 
      Alignment       =   1  'Right Justify
      Caption         =   "Location"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   2520
      TabIndex        =   21
      Top             =   2520
      Width           =   855
   End
   Begin VB.Label Label5 
      Alignment       =   1  'Right Justify
      Caption         =   "SubCharSet"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   15
      Top             =   2040
      Width           =   1095
   End
   Begin VB.Label Label4 
      Alignment       =   1  'Right Justify
      Caption         =   "SubFeature"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   13
      Top             =   2520
      Width           =   1095
   End
   Begin VB.Label Label3 
      Alignment       =   1  'Right Justify
      Caption         =   "sTimer"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   2760
      TabIndex        =   11
      Top             =   2040
      Width           =   615
   End
   Begin VB.Label Label2 
      Caption         =   "Remote   Port:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   720
      Width           =   1575
   End
   Begin VB.Label Label1 
      Caption         =   "Remote  Host:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   120
      TabIndex        =   2
      Top             =   240
      Width           =   1575
   End
End
Attribute VB_Name = "frmServer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private iDisplay As Integer
Private iPwdMode As Integer

Private Sub DisplayData()
  Dim strPath As String
  Dim strFile As String
  On Error Resume Next
  
  txtServer.Text = strServer
  txtPort.Text = nPort
  optMode(nDisplayMode).Value = True
  Optpwd(nPwdMode).Value = True
  txtSubCharSet.Text = strSubCharSet
  txtTimer.Text = nTmServer
  txtSubFeature.Text = strSubFeature
  txtLocation.Text = nFeatureLoc
End Sub

Private Sub cmdCancel_Click()
  Unload Me
End Sub

Private Sub cmdOK_Click()
    Dim nTmp As Integer
    
    strServer = Trim(txtServer.Text)
    nPort = Val(txtPort.Text)
    
    nDisplayMode = iDisplay
    nPwdMode = iPwdMode
    
    strSubCharSet = Trim(txtSubCharSet.Text)
    
    nTmp = Val(txtTimer.Text)
    If nTmp >= 50 And nTmp <= 15000 Then
        nTmServer = nTmp
        With frmMain.TimerServer
            .Enabled = False
            .Interval = nTmp
        End With
    End If
    
    strSubFeature = Trim(txtSubFeature.Text)
    nFeatureLoc = Val(txtLocation.Text)
    
    nUserDefine = 0
    If Len(strSubCharSet) > 0 Then nUserDefine = 1
    If Len(strSubFeature) > 0 Then nUserDefine = 2
    If Len(strSubCharSet) > 0 And Len(strSubFeature) > 0 Then nUserDefine = 3
    
    Unload Me
End Sub

Private Sub cmdRestore_Click()
  frmMain.LoadDataFromDisk
  DisplayData
End Sub

Private Sub cmdSave_Click()
  Dim strFile As String
  Dim strData As String
  On Error Resume Next
  
  strFile = App.Path + "\" + "Setup.ini"
  
  strData = Trim(txtServer.Text) + "/" + _
            Trim(txtPort.Text) + "/" + _
            Trim(Str(iDisplay)) + "/" + _
            Trim(Str(iPwdMode)) + "/" + _
            Trim(txtSubCharSet.Text) + "/" + _
            Trim(txtTimer.Text) + "/" + _
            Trim(txtSubFeature.Text) + "/" + _
            Trim(txtLocation.Text) + "/"
              
  WriteStringToTxt strData, strFile
  MsgBox "Save OK!", vbInformation + vbOKOnly
End Sub

Private Sub Form_Load()
  DisplayData
End Sub

Private Sub optMode_Click(Index As Integer)
  iDisplay = Index
End Sub

Private Sub optPwd_Click(Index As Integer)
  iPwdMode = Index
End Sub

⌨️ 快捷键说明

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