2
votes

I want to write logs in Event viewer under "Applications and Services logs"section using c++. But I cannot find any interface about it, Does anybody know?

I have tried "RegisterEventSource", "ReportEvent", but i can only write event viewer logs in Applications but not under Applications and Services logs.

I also find some samples in C#, but my application is in C++.

Thanks.

1

1 Answers

1
votes

You can have a look at the EventWrite function. It is contained in the evntprov.h. This allows you to write a specific entry to a Register Handle. By using EventRegister you can create a Register Handle. Remember to call EventUnregsiter when you are done with the Register Handle.

I have unfortunately not worked with this in quite a while. Have a read over at Windows Docs about evntprov.h and all its functionality. I am sure it will point you in the correct direction.