Smazßnφ NT EventLogu

Postup:
Do deklaraΦnφ Φßsti formulß°e zapiÜte:

Private Declare Function ClearEventLog Lib "advapi32.dll" _
   Alias "ClearEventLogA" ( _
   ByVal hEventLog As Long, _
   ByVal lpBackupFileName As String) _
   As Long

Private Declare Function CloseEventLog Lib "advapi32.dll" ( _
   ByVal hEventLog As Long) _
   As Long

Private Declare Function OpenEventLog Lib "advapi32.dll" _
   Alias "OpenEventLogA" ( _
   ByVal lpUNCServerName As String, _
   ByVal lpSourceName As String) _
   As Long

Na formulß° p°idejte tlaΦφtko a na jeho udßlost click:
Private Sub Command1_Click()

   Dim hEventLog As Long
   Dim lretv As Long

   hEventLog = OpenEventLog(vbNullString, "Application")
   If hEventLog = 0 Then
      Debug.Print "Chyba p°i otevφrßnφ EventLogu"
      Exit Sub
   End If

   lretv = ClearEventLog(hEventLog, vbNullString)
   If lretv = 0 Then
      Debug.Print "Chyba p°i ΦiÜt∞nφ EventLogu"
      Exit Sub
   End If

   lretv = CloseEventLog(hEventLog)
   If lretv = 0 Then
      Debug.Print "Chyba p°i zavφrßnφ EventLogu"
      Exit Sub
   End If

End Sub

Zp∞t

Autor: The Bozena