Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-02

TEventLog, RegisterMessageFile and {$R fclel.res}

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers

Hi all,

While adapting some code to use Eventlog I found RegisterMessageFile, which the help helpfully explains (it registers the file used by Windows to show certain strings in the event viewer).

Decided I liked/needed that and did this:

{$R fclel.res}
...
FLog.RegisterMessageFile('');

However, on compiling I get a "can't open resource file" error.

Is copying over
($fpcdir)\fcl-base\src\win\fclel.res
to the application directory the best solution?

Thanks,
Reinier

Reply by email

Michael Van Canneyt
to Reinier Olislagers
Reinier Olislagers wrote 11 lines
Hi all, While adapting some code to use Eventlog I found RegisterMessageFile, which the help helpfully explains (it registers the file used by Windows to show certain strings in the event viewer). Decided I liked/needed that and did this: {$R fclel.res} ... FLog.RegisterMessageFile('');

That should be ParamStr(0) instead of empty string.

Show quoted text 6 lines
However, on compiling I get a "can't open resource file" error. Is copying over ($fpcdir)\fcl-base\src\win\fclel.res to the application directory the best solution?

It is by far the easiest.

Michael.

Reply by email

Reinier Olislagers
to Michael Van Canneyt
Michael Van Canneyt wrote 8 lines
On Sat, 16 Feb 2013, Reinier Olislagers wrote: > Decided I liked/needed that and did this: > > {$R fclel.res} > ... > FLog.RegisterMessageFile(''); That should be ParamStr(0) instead of empty string.
Are you sure? FPC 2.6.0:
Function TEventLog.RegisterMessageFile(AFileName : String) : Boolean;
...
      If AFileName='' then
        AFileName:=ParamStr(0);

If so, then perhaps the help should be edited
"If AFileName is empty, the filename of the application binary is substituted."?

Show quoted text 7 lines
> However, on compiling I get a "can't open resource file" error. > > Is copying over > ($fpcdir)\fcl-base\src\win\fclel.res > to the application directory the best solution? It is by far the easiest.

Ok, thanks, Michael!

Reply by email

Michael Van Canneyt
to Reinier Olislagers
Reinier Olislagers wrote 19 lines
On 16-2-2013 12:26, Michael Van Canneyt wrote: > On Sat, 16 Feb 2013, Reinier Olislagers wrote: >> Decided I liked/needed that and did this: >> >> {$R fclel.res} >> ... >> FLog.RegisterMessageFile(''); > > That should be ParamStr(0) instead of empty string. Are you sure? FPC 2.6.0: Function TEventLog.RegisterMessageFile(AFileName : String) : Boolean; ... If AFileName='' then AFileName:=ParamStr(0); If so, then perhaps the help should be edited "If AFileName is empty, the filename of the application binary is substituted."?

I forgot that I had changed this :)

Michael.

Reply by email