Thats right, 
you have to use the microsoft message compiler which then spits out a RES
file and include that in your application. You then also have to register
you application so that the event log knows which exe or dll contains the
messages.

MessageId=5
SymbolicName=EVENTLOG_CAT_EXPORTER
Language=English
Results Export
.

And

  //Registry Key values
  EventTypesKey     = 'TypesSupported';
  EventCatCountKey  = 'CategoryCount';
  EventMessagesKey  = 'EventMessageFile';
  EventCategoryKey  = 'CategoryMessageFile';

  EventLogKey    =
'\SYSTEM\CurrentControlSet\Services\EventLog\Application\YourAppName';

  {$IFDEF CHECKEVENTLOG}
    Rgstry := TRegistry.Create;
    try                                                 
      GetDLLFileName;
      Rgstry.RootKey := HKEY_LOCAL_MACHINE;
      if not (Rgstry.OpenKeyReadOnly( EventLogKey ) and (DLLFileName =
Rgstry.ReadString( EventMessagesKey )) and (Rgstry.ReadInteger(
EventCatCountKey ) = EVENTLOG_CAT_COUNT)) then begin
        Rgstry.CloseKey;
        Rgstry.RootKey := HKEY_LOCAL_MACHINE;
        Rgstry.Access  := KEY_WRITE or ((STANDARD_RIGHTS_READ or
KEY_QUERY_VALUE) and not SYNCHRONIZE);
        if Rgstry.OpenKey( EventLogKey, True ) then begin
          Rgstry.WriteInteger( EventTypesKey, 7 );
          Rgstry.WriteInteger( EventCatCountKey, EVENTLOG_CAT_COUNT );
          Rgstry.WriteExpandString( EventMessagesKey, DLLFileName );
          Rgstry.WriteExpandString( EventCategoryKey, DLLFileName );
        end;
      end;
    finally
      Rgstry.CloseKey;
      Rgstry.Free;
    end;
  {$ENDIF}

Myles.


-----Original Message-----
From: Nello Sestini [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 16 October 2001 12:49 p.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Event Log interaction with Delphi


> The problem I have is then getting the event log to pickup the correct
> message form the application. What I have tried is to create a StringTable
> in a resource file like below, but currently I have had no success and are
> still getting the default message.
>
> STRINGTABLE
> {
> 71006, "My custom event message here"
> }
>
> If anyone can shed some light on how to do this it would be greatly
> appreciated


I've never done this in a Delphi App - but have using VC++ and that project
does it (I hope you are sitting down) like this:

as part of the application build, BEFORE the link or compile, it runs
a utility called MC.EXE

MC takes a text .MC file with messages (separated by blank lines) formatted
like this:

MessageID=
SymbolicName=MC_REBOOTSENTRYSTARTED
Language=English
Reboot sentry thread started
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to