久しぶりに

こんなのとか。イベントログを書き出すプログラム。14行目の「Application」をいろいろ変えてみるとちょっといいかも。


Option Explicit
Option Strict

Imports System
Imports System.Diagnostics

Class hoge
Public Shared Sub Main()

Dim myEventlog As New EventLog
Dim objEventLogCollection As EventLogEntryCollection
Dim objEntry As EventLogEntry

myEventlog.Log = "Application"
objEventLogCollection = myEventlog.Entries

For Each objEntry In objEventLogCollection
Console.WriteLine(objEntry.Source & ": " _
& objEntry.TimeGenerated & ": " _
& objEntry.Message)
Next
End Sub
End Class

コンパイルオプションは以下のとおり。

> vbc /t:exe /out:hogelog.exe /r:system.dll /debug+ .vb
あ、ちなみに.NET Framework 1.0だと、コンパイルできない風味。1.1推奨ということで。