Rev 2 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2 | Rev 3 | ||
---|---|---|---|
1 | program LogWriteTestDelphi; |
1 | program LogWriteTestDelphi; |
2 | 2 | ||
3 | {$APPTYPE CONSOLE} |
3 | {$APPTYPE CONSOLE} |
4 | 4 | ||
5 | {$R *.res} |
5 | {$R *.res} |
6 | 6 | ||
7 | uses |
7 | uses |
8 | System.SysUtils, |
8 | System.SysUtils, |
9 | ActiveX, |
9 | ActiveX, |
10 | ViaThinkSoftSimpleLogEvent_TLB in '..\TLB\ViaThinkSoftSimpleLogEvent_TLB.pas'; |
10 | ViaThinkSoftSimpleLogEvent_TLB in '..\TLB\ViaThinkSoftSimpleLogEvent_TLB.pas'; |
11 | 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 |
12 | var |
19 | x: IViaThinkSoftSimpleEventLog; |
13 | x: IViaThinkSoftSimpleEventLog; |
20 | begin |
14 | begin |
21 | try |
15 | try |
22 | CoInitialize(nil); |
16 | CoInitialize(nil); |
23 | x := CoViaThinkSoftSimpleEventLog.Create; |
17 | x := CoViaThinkSoftSimpleEventLog.Create; |
24 | {$IFDEF WIN64} |
18 | {$IFDEF WIN64} |
25 | x.LogEvent(LOGEVENT_MSG_WARNING, 'This is a test warning written by Delphi 64 bit'); |
19 | x.LogEvent('MySourceName', ViaThinkSoftSimpleLogEvent_TLB.Warning, 'This is a test warning written by Delphi 64 bit'); |
26 | {$ELSE} |
20 | {$ELSE} |
27 | x.LogEvent(LOGEVENT_MSG_WARNING, 'This is a test warning written by Delphi 32 bit'); |
21 | x.LogEvent('MySourceName', ViaThinkSoftSimpleLogEvent_TLB.Warning, 'This is a test warning written by Delphi 32 bit'); |
28 | {$ENDIF} |
22 | {$ENDIF} |
29 | x := nil; |
23 | x := nil; |
30 | //CoUninitialize; // TODO: If I do this, I get an access violation at process end?! |
24 | //CoUninitialize; // TODO: If I do this, I get an access violation at process end?! |
31 | except |
25 | except |
32 | on E: Exception do |
26 | on E: Exception do |
33 | Writeln(E.ClassName, ': ', E.Message); |
27 | Writeln(E.ClassName, ': ', E.Message); |
34 | end; |
28 | end; |
35 | end. |
29 | end. |
36 | 30 |