I\'m looking for a (fairly pain-free) means of adding some Windows Application Event-Log support to a small legacy Delphi 5 application. We just want it to log when it start
For simple event logging in D5, I have used the following code to add messages to the Applications log.
Use this code to add your text message and an ID number (last parameter on LogMessage lines)
with TEventLogger.create('My Application Name') do
begin
try
LogMessage('Information Message!', EVENTLOG_INFORMATION_TYPE, 0, 1);
LogMessage('Error Message!', EVENTLOG_ERROR_TYPE, 0, 2);
LogMessage('Warning Message!', EVENTLOG_WARNING_TYPE, 0, 3);
LogMessage('Audit Success Message!', EVENTLOG_AUDIT_SUCCESS, 0, 4);
LogMessage('Audit Failure Message!', EVENTLOG_AUDIT_FAILURE, 0, 5);
finally
free;
end;
end;