📄 log.frm
字号:
VERSION 5.00
Object = "{75D4F666-8785-11D3-93AD-0000832EF44D}#3.1#0"; "FAST2006.ocx"
Begin VB.Form frmLog
BorderStyle = 3 'Fixed Dialog
Caption = "Log class"
ClientHeight = 4635
ClientLeft = 45
ClientTop = 330
ClientWidth = 6705
Icon = "Log.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4635
ScaleWidth = 6705
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.Frame fraFrame
Caption = "View Log c:\fastwin.log"
Height = 2760
Index = 1
Left = 135
TabIndex = 6
Top = 1755
Width = 6450
Begin VB.CommandButton cmdRefresh
Caption = "Refresh"
Height = 375
Left = 135
TabIndex = 8
Top = 2250
Width = 1680
End
Begin VB.ListBox lstMessages
Height = 1815
Left = 135
TabIndex = 7
Top = 315
Width = 5685
End
Begin VB.Image imgIcon
Height = 480
Index = 2
Left = 5895
Picture = "Log.frx":000C
Top = 1485
Width = 480
End
Begin VB.Image imgIcon
Height = 480
Index = 1
Left = 5895
Picture = "Log.frx":044E
Top = 855
Width = 480
End
Begin VB.Image imgIcon
Height = 480
Index = 0
Left = 5900
Picture = "Log.frx":0890
Top = 315
Width = 480
End
End
Begin VB.Frame fraFrame
Caption = "Log messages to c:\fastwin.log"
Height = 1500
Index = 0
Left = 135
TabIndex = 0
Top = 90
Width = 6450
Begin VB.CommandButton cmdPost
Caption = "Write message"
Height = 375
Left = 180
TabIndex = 3
Top = 945
Width = 1680
End
Begin VB.TextBox txtMsg
Height = 330
Left = 180
TabIndex = 2
Text = "This is a test"
Top = 540
Width = 4065
End
Begin VB.ComboBox cboType
Height = 315
ItemData = "Log.frx":0CD2
Left = 4410
List = "Log.frx":0CDF
Style = 2 'Dropdown List
TabIndex = 1
Top = 540
Width = 1770
End
Begin VB.Label lblLabel
AutoSize = -1 'True
Caption = "Type"
Height = 195
Index = 1
Left = 4410
TabIndex = 5
Top = 315
Width = 360
End
Begin VB.Label lblLabel
AutoSize = -1 'True
Caption = "Message to log"
Height = 195
Index = 0
Left = 180
TabIndex = 4
Top = 315
Width = 1080
End
End
Begin FLWDiskFile.FWLog objLog
Left = 0
Top = 1500
_ExtentX = 820
_ExtentY = 820
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 Form_Load()
objLog.AppName = App.EXEName
objLog.AppInstance = App.hInstance
objLog.FilePath = "c:\.log"
imgIcon(0).Visible = False
imgIcon(1).Visible = False
imgIcon(2).Visible = False
imgIcon(0).Left = 5900
imgIcon(1).Left = 5900
imgIcon(2).Left = 5900
imgIcon(0).Top = 315
imgIcon(1).Top = 315
imgIcon(2).Top = 315
cboType.ListIndex = 0
cmdRefresh.Value = True
End Sub
Private Sub cmdPost_Click()
Dim intType As FLWDiskFile.flwLogMsgType
Select Case cboType.ListIndex
Case 0
intType = FLWDiskFile.flwLogError
Case 1
intType = FLWDiskFile.flwLogMsg
Case 2
intType = FLWDiskFile.flwLogWarning
End Select
Call objLog.PostMsg(txtMsg, intType)
End Sub
Private Sub cmdRefresh_Click()
Dim objEntry As FLWDiskFile.IFWLogEntry
Call objLog.Refresh
Call lstMessages.Clear
For Each objEntry In objLog.Entries
Call lstMessages.AddItem(objEntry.DateTime & " : " & objEntry.Message)
Next
If lstMessages.ListCount > 0 Then
lstMessages.ListIndex = 0
End If
End Sub
Private Sub lstMessages_Click()
imgIcon(0).Visible = False
imgIcon(1).Visible = False
imgIcon(2).Visible = False
Select Case objLog.Entries(lstMessages.ListIndex + 1).MsgType
Case FLWDiskFile.flwLogMsg
imgIcon(0).Visible = True
Case FLWDiskFile.flwLogWarning
imgIcon(1).Visible = True
Case FLWDiskFile.flwLogError
imgIcon(2).Visible = True
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -