Link to home
Start Free TrialLog in
Avatar of falconew
falconew

asked on

Get EventLog using VB

Does anyone know hot to get the record in the event log of windows NT or 2000? I need to make an application that read the event log and insert it into database.
I searched the MSDN but I only get the sample using Visual C++.
Any help or direction would be great appreciated.
ASKER CERTIFIED SOLUTION
Avatar of xSinbad
xSinbad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cpearl_s
cpearl_s

Hope this will guide u in rest of u'r process.
Just take a backup of the application event log, then
try write database programm that format that message and store in a db as specified in message format.
Iam also trying that , if i get that i let u know, hope u to the same.


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

Private Sub cmdBkUpLog_Click()
Dim lng As Long
Dim str As String

lng = BackupEventLog(OpenEventLog("ServerName", "Application"), "C:\Eve.txt")

End Sub


regards
cpearl
Avatar of falconew

ASKER

Thanks xSinbad,
It is I was looking for.
For my great thanks I increase the point to be 350.

Thanks also to cpearl_s, actually it is the last solution I've ever think if I can't find the solution from xSinbad.