[Overview][Resource strings][Types][Classes][Index] Reference for unit 'eventlog' (#fcl)

TEventLog.RegisterMessageFile

Register message file

Declaration

Source position: eventlog.pp line 74

public function TEventLog.RegisterMessageFile(

  AFileName: string

):Boolean; virtual;

Arguments

AFileName

  

Filename with messages as resource strings.

Function result

True if the call was succesful, False if not.

Description

RegisterMessageFile is used on Windows to register the file AFileName containing the formatting strings for the system messages. This should be a file containing resource strings. If AFileName is empty, the filename of the application binary is substituted.

When a message is logged to the windows system log, Windows looks for a formatting string in the file registered with this call.

There are 2 kinds of formatting strings:

Category strings these should be numbered from 1 to 4

1
Should contain the description of the etInfo event type.
2
Should contain the description of the etWarning event type.
4
Should contain the description of the etError event type.
4
Should contain the description of the etDebug event type.

None of these strings should have a string substitution placeholder.

The second type of strings are the message definitions. Their number starts at EventIDOffset (default is 1000) and each string should have 1 placeholder.

Free Pascal comes with a fclel.res resource file which contains default values for the 8 strings, in english. It can be linked in the application binary with the statement

{$R fclel.res}

This file is generated from the fclel.mc and fclel.rc files that are distributed with the Free Pascal sources.

If the strings are not registered, windows will still display the event messages, but they will not be formatted nicely.

Note that while any messages logged with the event logger are displayed in the event viewern Windows locks the file registered here. This usually means that the binary is locked.

On non-windows operating systems, this call is ignored.

Errors

If AFileName is invalid, false is returned.


Documentation generated on: Nov 14 2015