Event Reporting from C++ APP : Displaying Same Message in General and Details Tab in Event Viewer

ravidolas 1 Reputation point
2021-10-25T02:26:48.793+00:00

C++ Application when writing event to event log, the event message gets displayed in event viewer. Issue is the message gets displayed properly in Details tab but the General tab always have different message like "The operation completed successfully".
How can I display same message in both General and Details Tab of event viewer using C++? Do not want to use C++/CLI.
This is working perfectly fine when using VB.Net and same message is getting displayed on both tabs in event viewer.

Am not able to display the same message in both General and Details tab.
Using ReportEvent() API :

ReportEvent(hEventSource, EVENTLOG_INFORMATION_TYPE,
0, // event category
0, // event identifier
NULL,
1, // size of string array
0, // no binary data
lpszStringArray, // string array
NULL); // no binary data
Let me know if need more details.

Windows development Windows API - Win32
Developer technologies C++
{count} votes

2 answers

Sort by: Most helpful
  1. Jay Kean 15 Reputation points
    2023-08-21T19:02:08.3766667+00:00

    I see this when viewing event logs from disparate Windows Operating systems - viewing a windows event log from a Windows 2012 server on a Windows 11 desktop when I did not have this issue with Windows 10 systems. The error tab shows the proper error but the General tab just shows "The operation completed successfully" instead of the usual error message. If you double click the line in the event viewer there is a Copy button which will copy the XML detail but the description will still be the successfully message like:
    Description:

    The operation completed successfully.

    Event Xml:

    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

    The Friendly and xml views are far from that. What's more is the "The operation completed successfully." messaging can be misconstrued on the general tab when the other tab shows a definite error.

    I love Windows 11 for a lot of reasons but this is not one of them. Its a definite thumbs down.

    1 person found this answer helpful.
    0 comments No comments

  2. Olivier gg 0 Reputation points
    2023-03-25T16:01:58.6433333+00:00

    The behavior of ReportEvent() may have changed since "some" Windows Version. I had exactly the same issue today: On my Windows 11, I also get "The operation completed successfully" instead of the usual error message I want.

    With the same application (an ATL service), the message is reported as expected on Windows 7, maybe on 8.1 too (did not try 8.1). The first part of the message some french text that I'm used to see when I do not have a message file; the end is the error message I was expecting ("Error type: parse failed").

    "La description de l’ID d’événement 0 dans la source smallrouterService est introuvable. Le composant qui a déclenché cet événement n’est pas installé sur l’ordinateur local ou l’installation est endommagée. Vous pouvez installer ou réparer le composant sur l’ordinateur local.

    Si l’événement provient d’un autre ordinateur, les informations d’affichage doivent être enregistrées avec l’événement.

    Les informations suivantes étaient incluses avec l’événement :

    Une exception s’est produite. - Error type: parse failed,

    blah blah...".

    The way to fix it seems to be adding a message file.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.