> 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
.

and produces as output 3 files:

   (1) a C++ header file with defines like this:

//
// MessageId: MC_REBOOTSENTRYSTARTED
//
// MessageText:
//
//  Reboot sentry thread started
//
#define MC_REBOOTSENTRYSTARTED           0x00001009L

   (2) a binary .bin file (call it MSG00001.bin).


the program includes the .h file so it can reference the
#defined message identifiers in calls to the EventLog API.


   (3) and a .rc file to include with the application resource
   script .rc file for the app with lines like these:

LANGUAGE 0x9,0x1
1 11 MSG00001.bin


When the application .rc script is compiled, it will use
the .bin file to create a type "11" binary resource which
is what the NT message system expects to find when formatting
messages.

It is one of Microsofts more spectacular examples of making
something that could be so simple absurdly complex.

The one problem that i don't see a way around is what you use
to compile the .mc file to create that binary resource.    The
MC utility I'm using is part of the Win32 SDK - maybe you can
download it from the MS website - not sure.

BTW - one word of caution - debugging this stuff is a pain
because of DLL caching.

hope this is useful

-ns
http://roserox.co.th




---------------------------------------------------------------------------
    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