Subversion Repositories simple_log_event

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
program LogWriteTestDelphi;
2
 
3
{$APPTYPE CONSOLE}
4
 
5
{$R *.res}
6
 
7
uses
8
  System.SysUtils,
9
  ActiveX,
10
  ViaThinkSoftSimpleLogEvent_TLB in '..\TLB\ViaThinkSoftSimpleLogEvent_TLB.pas';
11
 
12
const
13
  LOGEVENT_MSG_SUCCESS       = 0;
14
  LOGEVENT_MSG_INFORMATIONAL = 1;
15
  LOGEVENT_MSG_WARNING       = 2;
16
  LOGEVENT_MSG_ERROR         = 3;
17
 
18
var
19
  x: IViaThinkSoftSimpleEventLog;
20
begin
21
  try
22
    CoInitialize(nil);
23
    x := CoViaThinkSoftSimpleEventLog.Create;
24
    {$IFDEF WIN64}
25
    x.LogEvent(LOGEVENT_MSG_WARNING, 'This is a test warning written by Delphi 64 bit');
26
    {$ELSE}
27
    x.LogEvent(LOGEVENT_MSG_WARNING, 'This is a test warning written by Delphi 32 bit');
28
    {$ENDIF}
29
    x := nil;
30
    //CoUninitialize; // TODO: If I do this, I get an access violation at process end?!
31
  except
32
    on E: Exception do
33
      Writeln(E.ClassName, ': ', E.Message);
34
  end;
35
end.