|
Querying the Event Log
The following code sample displays the number of event records currently in
the Application event log and the System event log.
/* Open the System log. */
h = OpenEventLog(NULL, /* uses local computer */
"System"); /* source name */
if (h == NULL)
ErrorExit("could not open System event log");
/* Get the number of records in the System event log. */
if (!GetNumberOfEventLogRecords(h, &cRecords))
ErrorExit
("could not get number of records");
printf("There are %d records in the System event log.\n", cRecords);
CloseEventLog(h);
/* Open the Application log. */
h = OpenEventLog(NULL, /* uses local computer */
"Application"); /* source name */
if (h == NULL)
ErrorExit("could not open Application event log");
/* Get the number of records in the Application event log. */
if (!GetNumberOfEventLogRecords(h, &cRecords))
ErrorExit("could not get number of records");
printf("There are %d records in the Application event log.\n",
cRecords);
CloseEventLog(h);
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
TMS Scripter Studio Pro components for Delphi/C++Builder
More Online Helps
Win32 Multimedia Programmer's Reference (mmedia.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|