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

📄 frmsetinterval.frm

📁 基于VC++串口编程。经过好长时间的寻找
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmSetInterval 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "设置数据获取时间间隔"
   ClientHeight    =   1464
   ClientLeft      =   36
   ClientTop       =   324
   ClientWidth     =   4260
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   10.8
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmSetInterval.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1464
   ScaleWidth      =   4260
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox txtInterval 
      Height          =   324
      Left            =   696
      TabIndex        =   3
      Top             =   720
      Width           =   1260
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "退出"
      Height          =   336
      Left            =   2844
      TabIndex        =   1
      Top             =   744
      Width           =   1176
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确认"
      Default         =   -1  'True
      Height          =   336
      Left            =   2844
      TabIndex        =   0
      Top             =   240
      Width           =   1176
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "小时"
      Height          =   216
      Left            =   1968
      TabIndex        =   4
      Top             =   768
      Width           =   432
   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            =   252
      TabIndex        =   2
      Top             =   264
      Width           =   1920
   End
End
Attribute VB_Name = "frmSetInterval"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim OldInterval As Single

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    txtInterval.Text = Format(Val(txtInterval.Text), "#####0.00")
    If Val(txtInterval.Text) <= 0.5 Then
        MsgBox "时间间隔最小不得少于半小时!"
        txtInterval.SetFocus
    Else
        g_nGetDataInterval = Val(txtInterval.Text)
        If OldInterval <> g_nGetDataInterval Then
            MsgBox "新的时间间隔为:" & Format(g_nGetDataInterval) & "小时"
            g_nGetDataInterval = g_nGetDataInterval
            '写入保存文件
            Call SaveNewInterval
        End If
        Unload Me
    End If
End Sub

Private Sub Form_Load()
    OldInterval = g_nGetDataInterval
    txtInterval.Text = Format(g_nGetDataInterval, "#####0.00")
End Sub

'新的时间间隔设置
Private Sub SaveNewInterval()
Dim sFile As String, hF As Integer
Dim tmpInterval, tmpID
Dim tmp1, tmp2
    
    On Error Resume Next
    sFile = GetAppPath & "server.ini"
    hF = FreeFile
    Open sFile For Input As #hF
    Input #hF, tmpInterval, tmp1
    Input #hF, tmpID, tmp2
    Close #hF
    
    hF = FreeFile
    Open sFile For Output As #hF
    Print #hF, g_nGetDataInterval, tmp1
    Print #hF, tmpID, tmp2
    Close #hF
End Sub

⌨️ 快捷键说明

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