I found an example in C# how to add new Event to the Event Viewer.
But, I need an example written in C++ (not .NET) that create new Event to the Event Viewer under the “Application” part.
I found an example in C# how to add new Event to the Event
Share
You can use these three functions from the WINAPI:
Here is a quick example of how to use these and to display messages correctly in the event log (error handling mostly ignored for brevity).
Create a resource containg message information from the following
Event_log.mcfile:To build the
.mcfile and.resresource file I executed the following:This will create a header file called
Event_log.hin the current directory and aresourcesdirectory containing a file namedEvent_log.reswhich you must link in to your application binary.Example
main.cpp:Hope this helps but consider that this approach has been deprecated as stated by @Cody Gray.