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

📄 frmlog.frm

📁 完整的VB和单片机系统连接的源代码
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form frmLog 
   Caption         =   "日志"
   ClientHeight    =   4695
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7515
   LinkTopic       =   "Form1"
   ScaleHeight     =   4695
   ScaleWidth      =   7515
   StartUpPosition =   1  '所有者中心
   Begin MSComDlg.CommonDialog CdlSave 
      Left            =   2880
      Top             =   4440
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "保存副本"
      Height          =   375
      Left            =   1080
      TabIndex        =   3
      Top             =   4320
      Width           =   855
   End
   Begin VB.CommandButton cmdClear 
      Caption         =   "清空"
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   4320
      Width           =   615
   End
   Begin VB.CommandButton cmdClose 
      Cancel          =   -1  'True
      Caption         =   "关闭"
      Height          =   375
      Left            =   6120
      TabIndex        =   1
      Top             =   4320
      Width           =   615
   End
   Begin VB.TextBox txtLog 
      Height          =   4335
      Left            =   0
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   0
      Text            =   "frmLog.frx":0000
      Top             =   0
      Width           =   7455
   End
End
Attribute VB_Name = "frmLog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit


'保存
Private Sub CmdSave_Click()
'当“保存”对话框按钮被按下时
    With CdlSave
        On Error Resume Next
        .CancelError = True
        .DialogTitle = "保存文件"
        .FileName = Replace(Str(Now), ":", ";")
        '解释见上面
        .Filter = "文本文件(*.txt)|*.txt"
        .Flags = cdlOFNCreatePrompt + cdlOFNHideReadOnly
        .ShowSave
        If Err = cdlCancel Then Exit Sub
        Call SaveLog("保存日志的副本:" & .FileName)
        Call FileCopy(fnWorkLogFileName, .FileName)
        MsgBox "在保存了副本" & .FileName, , "保存日志的副本"
    End With
Exit Sub


End Sub

Private Sub cmdClear_Click()
    Dim s As String   ' 从文件中读出的每条提示。
    Dim i As Integer
    i = MsgBox("警告:清空后,日志将丢失。请单击“保存”保存一个副本后再清空日志。确实要清空吗?", vbYesNo, "清空日志")
    If i = vbYes Then
        '清空日志
        Call Kill(fnWorkLogFileName)
        Call SaveLog("煤矿升降机综合后备保护仪 日志(以前内容已经清空)")
        Call ShowLog
    End If
End Sub
Public Sub ShowLog()
    Dim sShow As String   ' 从文件中读出的每条提示。
    Dim s As String
    Dim tl As Long
    ' 包含下一个自由文件描述符。
    
    ' 在打开前确保文件存在。
    If Dir(fnWorkLogFileName) = "" Then
        MsgBox "日志文件 " & fnWorkLogFileName & "不存在。新建一个空白日志。"
        Call SaveLog("煤矿升降机综合后备保护仪 日志")
    End If
    
    Open fnWorkLogFileName For Binary As 1
       sShow = Space(LOF(1))
    Get 1, , sShow
    Close 1
    txtLog.Text = sShow
    tl = Len(txtLog.Text)
    txtLog.SelStart = tl
End Sub



Private Sub Form_Load()
    'Call ShowLog
End Sub

Private Sub cmdClose_Click()
    Unload Me
End Sub

⌨️ 快捷键说明

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