var
  //From Caller
  StringToAdd1, StringToAdd2: String;
  //Handle to Eventlog
  hEventlog: THandle;
  //Pointer to hold the passed Strings
  p: array[0..1] of PChar;
  //Variables to hold Information for the Eventlog
  EventID: Word;
  CategoryID: Word;
begin
hEventLog := RegisterEventSource(nil, PChar(My Application'));
if hEventLog > 0 then
  begin
    p[0]:= PChar(StringToAdd1); //e.g. 'DBSERVER'
    p[1]:= PChar(StringToAdd2); //e.g. '0x80004005'
    ReportEvent(
                hEventLog,
                EVENTLOG_INFORMATION_TYPE,  // Event Type
                CategoryID,                 // Event Category ID --> e.g. 2 aka Server Connection Error
                EventID,                    // Event ID --> e.g. 6 aka 'Failed to connect to Server %1 HR: %2'
                nil,                        // User SID (optional)
                2,                          // Number of strings
                0,                          // Size of Binary Data
                @p,                         // Array of Strings to merge with Message
                nil                         // Address of Binary Data
               );
    //Disonnect from Eventlog
    DeRegisterEventSource(hEventLog);
  end;

