winapiadvapi32

Where can I find a good example of ReportEvent function usage?


As with most "legacy" MSDN pages, the page for ReportEvent has too little information for me to make much sense of it. I've tried searching, but can't find a good, clean, simple example of the function's usage. Could anyone suggest one?


Solution

  • I ended up using this:

    HANDLE eventLog;
    WORD type;
    const char* msg;
    
    // ... snip ...
    
    ReportEvent(eventLog, type, 0, 1, NULL, 1, 0, &LPCTSTR(msg), NULL);
    

    Seems to work well enough.