home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.0#0"; "COMDLG32.OCX"
- Object = "{97746B1E-E2AE-11D2-9A51-00000100C2E6}#1.0#0"; "AxEvntLg.ocx"
- Begin VB.Form FrmLog
- Caption = "Event reader"
- ClientHeight = 7875
- ClientLeft = 165
- ClientTop = 450
- ClientWidth = 10335
- LinkTopic = "Form1"
- ScaleHeight = 7875
- ScaleWidth = 10335
- StartUpPosition = 2 'CenterScreen
- Begin AxEvntLg.AxNTEventLog NTEventLogX
- Left = 660
- Top = 960
- MachineName = ""
- SourceName = "Application"
- Active = 0 'False
- BackupFileName = ""
- IncludeUserName = -1 'True
- End
- Begin MSComDlg.CommonDialog OpenDialog
- Left = 840
- Top = 6960
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- DefaultExt = "*.evt"
- Filter = "Event log (*.evt)|*.evt"
- End
- Begin VB.Frame Frame1
- Height = 75
- Left = 0
- TabIndex = 8
- Top = 0
- Width = 10275
- End
- Begin VB.ListBox lbxEvents
- BeginProperty Font
- Name = "Courier New"
- Size = 9
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 6360
- Left = 0
- TabIndex = 0
- Top = 360
- Width = 10155
- End
- Begin VB.Label Label7
- Caption = "Computer"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 9000
- TabIndex = 7
- Top = 120
- Width = 915
- End
- Begin VB.Label Label6
- Caption = "User"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 8160
- TabIndex = 6
- Top = 120
- Width = 615
- End
- Begin VB.Label Label5
- Caption = "Event"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 5460
- TabIndex = 5
- Top = 120
- Width = 675
- End
- Begin VB.Label Label4
- Caption = "Date"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 780
- TabIndex = 4
- Top = 120
- Width = 495
- End
- Begin VB.Label Label3
- Caption = "Category"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 4440
- TabIndex = 3
- Top = 120
- Width = 855
- End
- Begin VB.Label Label2
- Caption = "Source"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 3480
- TabIndex = 2
- Top = 120
- Width = 675
- End
- Begin VB.Label Label1
- Caption = "Time"
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 1740
- TabIndex = 1
- Top = 120
- Width = 495
- End
- Begin VB.Menu mniFile
- Caption = "File"
- Begin VB.Menu mniApplication
- Caption = "Application"
- Checked = -1 'True
- End
- Begin VB.Menu mniSecurity
- Caption = "Security"
- End
- Begin VB.Menu mniSystem
- Caption = "System"
- End
- Begin VB.Menu Divider1
- Caption = "-"
- End
- Begin VB.Menu mniBackup
- Caption = "Backup"
- End
- Begin VB.Menu mniOpen
- Caption = "Open"
- End
- Begin VB.Menu mniClear
- Caption = "Clear"
- End
- Begin VB.Menu Divider2
- Caption = "-"
- End
- Begin VB.Menu mniConnect
- Caption = "Connect"
- End
- Begin VB.Menu mniExit
- Caption = "Exit"
- End
- End
- Begin VB.Menu mniView
- Caption = "View"
- Begin VB.Menu mniNewest
- Caption = "Newest First"
- Checked = -1 'True
- End
- Begin VB.Menu mniOldest
- Caption = "Oldest First"
- End
- End
- Attribute VB_Name = "FrmLog"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Function GetString(ByVal Obj As IEventItem) As String
- S = Format(Obj.TimeWritten, "dd-mmm-yyyy hh:nn:ss ")
- S = S + Format(Obj.SourceName, "@@@@@@@@@@@@@@@@@ ")
- S = S + Format(Obj.EventCategory, " 0 ")
- If Obj.EventId < 0 Then J = 65536 - (Abs(Obj.EventId) Mod 65536) Else J = Obj.EventId Mod 65536
- S = S + Format(J, "00000")
- S = S + Format(Obj.UserName, " @@@@@@@@@@@@@@@@@@@@@@@ ")
- S = S + Format(Obj.ComputerName, " @@@@@@@@@@ ")
- GetString = S
- End Function
- Private Sub RereadEventLog()
- On Error GoTo ErrorHandler
- If Not NTEventLogX.BackupFileName = "" Then Caption = NTEventLogX.BackupFileName Else Caption = "Event reader " + NTEventLogX.MachineName + "\" + NTEventLogX.SourceName
- lbxEvents.Clear
- NTEventLogX.Active = False
- NTEventLogX.Active = True
- For i = 0 To NTEventLogX.Count - 1
- Set Obj = NTEventLogX.Objects(i)
- S = GetString(Obj)
- If mniOldest.Checked Then lbxEvents.AddItem (S) Else lbxEvents.AddItem S, 0
- Next i
- ExitProc:
- Exit Sub
- ErrorHandler:
- MsgBox (Err.Description)
- Resume ExitProc
- End Sub
- Private Sub Form_Load()
- NTEventLogX.MachineName = NTEventLogX.GetPrimaryDomainServerName
- NTEventLogX.Active = True
- RereadEventLog
- End Sub
- Private Sub Form_Resize()
- lbxEvents.Width = Width - 100
- lbxEvents.Height = Height - 950
- Frame1.Width = Width - 6
- End Sub
- Private Sub List1_Click()
- End Sub
- Private Sub Outline1_Click()
- End Sub
- Private Sub lbxEvents_DblClick()
- FrmDetails.Show (vbModal)
- End Sub
- Private Sub mniApplication_Click()
- mniApplication.Checked = True
- mniSystem.Checked = False
- mniSecurity.Checked = False
- NTEventLogX.SourceName = "Application"
- RereadEventLog
- End Sub
- Private Sub mniBackup_Click()
- OpenDialog.ShowSave
- If Not OpenDialog.filename = "" Then
- NTEventLogX.BackupFileName = OpenDialog.filename
- NTEventLogX.BackupEventLog
- NTEventLogX.BackupFileName = ""
- End If
- End Sub
- Private Sub mniClear_Click()
- On Error GoTo ErrorHandler
- If MsgBox("Are you sure to delete all items from event log ?", vbOKCancel, "Confirmation") = vbCancel Then Exit Sub
- NTEventLogX.Clear
- RereadEventLog
- ExitProc:
- Exit Sub
- ErrorHandler:
- MsgBox (Err.Description)
- Resume ExitProc
- End Sub
- Private Sub mniConnect_Click()
- FrmConnect.Show (vbModal)
- If Not NTEventLogX.Active Then RereadEventLog
- End Sub
- Private Sub mniExit_Click()
- Unload FrmLog
- End Sub
- Private Sub mniNewest_Click()
- mniNewest.Checked = True
- mniOldest.Checked = False
- RereadEventLog
- End Sub
- Private Sub mniOldest_Click()
- mniNewest.Checked = False
- mniOldest.Checked = True
- RereadEventLog
- End Sub
- Private Sub mniOpen_Click()
- OpenDialog.ShowOpen
- If Not OpenDialog.filename = "" Then
- NTEventLogX.BackupFileName = OpenDialog.filename
- RereadEventLog
- NTEventLogX.BackupFileName = ""
- End If
- End Sub
- Private Sub mniSecurity_Click()
- mniApplication.Checked = False
- mniSystem.Checked = False
- mniSecurity.Checked = True
- NTEventLogX.SourceName = "Security"
- RereadEventLog
- End Sub
- Private Sub mniSystem_Click()
- mniApplication.Checked = False
- mniSystem.Checked = True
- mniSecurity.Checked = False
- NTEventLogX.SourceName = "System"
- RereadEventLog
- End Sub
- Private Sub NTEventLogX_OnChange()
- MsgBox ("Event log changed!")
- End Sub
-