Reporting an Event

After you have added a source name to the registry, use the RegisterEventSource function to get a handle of the Application event log, as in the following example, which gets the handle and then adds an event to the logs.

LPSTR aszMsg[] = {

"SamplApp",

};

HANDLE h;

h = RegisterEventSource(NULL, /* uses local computer */

"SamplApp"); /* source name */

if (h == NULL)

ErrorExit("could not register event source");

if (!ReportEvent(h, /* event log handle */

EVENTLOG_ERROR_TYPE, /* event type */

0, /* category zero */

0x1003, /* event identifier */

NULL, /* no user security identifier */

1, /* one substitution string */

0, /* no data */

(LPTSTR *) aszMsg, /* address of string array */

NULL)) /* address of data */

ErrorExit("could not report event");

DeregisterEventSource(h);

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database