Subversion Repositories simple_log_event

Rev

Rev 2 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  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. var
  13.   x: IViaThinkSoftSimpleEventLog;
  14. begin
  15.   try
  16.     CoInitialize(nil);
  17.     x := CoViaThinkSoftSimpleEventLog.Create;
  18.     {$IFDEF WIN64}
  19.     x.LogEvent('MySourceName', ViaThinkSoftSimpleLogEvent_TLB.Warning, 'This is a test warning written by Delphi 64 bit');
  20.     {$ELSE}
  21.     x.LogEvent('MySourceName', ViaThinkSoftSimpleLogEvent_TLB.Warning, 'This is a test warning written by Delphi 32 bit');
  22.     {$ENDIF}
  23.     x := nil;
  24.     //CoUninitialize; // TODO: If I do this, I get an access violation at process end?!
  25.   except
  26.     on E: Exception do
  27.       Writeln(E.ClassName, ': ', E.Message);
  28.   end;
  29. end.
  30.