1 |
(* ***** BEGIN LICENSE BLOCK *****
|
2 |
* Version: MPL 1.1
|
3 |
*
|
4 |
* The contents of this file are subject to the Mozilla Public License Version
|
5 |
* 1.1 (the "License"); you may not use this file except in compliance with
|
6 |
* the License. You may obtain a copy of the License at
|
7 |
* http://www.mozilla.org/MPL/
|
8 |
*
|
9 |
* Software distributed under the License is distributed on an "AS IS" basis,
|
10 |
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11 |
* for the specific language governing rights and limitations under the
|
12 |
* License.
|
13 |
*
|
14 |
* The Original Code is TurboPower SysTools
|
15 |
*
|
16 |
* The Initial Developer of the Original Code is
|
17 |
* TurboPower Software
|
18 |
*
|
19 |
* Portions created by the Initial Developer are Copyright (C) 1996-2002
|
20 |
* the Initial Developer. All Rights Reserved.
|
21 |
*
|
22 |
* Contributor(s):
|
23 |
*
|
24 |
* ***** END LICENSE BLOCK ***** *)
|
25 |
|
26 |
unit ExNLog1;
|
27 |
|
28 |
interface
|
29 |
|
30 |
uses
|
31 |
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
32 |
StdCtrls, StBase, StNTLog;
|
33 |
|
34 |
type
|
35 |
TForm1 = class(TForm)
|
36 |
Button1: TButton;
|
37 |
EL: TStNTEventLog;
|
38 |
Label1: TLabel;
|
39 |
Label2: TLabel;
|
40 |
Label3: TLabel;
|
41 |
ListBox1: TListBox;
|
42 |
Label4: TLabel;
|
43 |
Label5: TLabel;
|
44 |
Label6: TLabel;
|
45 |
Label7: TLabel;
|
46 |
procedure Button1Click(Sender: TObject);
|
47 |
private
|
48 |
{ Private declarations }
|
49 |
procedure MyOnRead(Sender : TObject; const EventRec : TStNTEventLogRec; var Abort : Boolean);
|
50 |
public
|
51 |
{ Public declarations }
|
52 |
end;
|
53 |
|
54 |
var
|
55 |
Form1: TForm1;
|
56 |
ReadCount : DWORD = 0;
|
57 |
|
58 |
implementation
|
59 |
|
60 |
{$R *.DFM}
|
61 |
|
62 |
procedure TForm1.MyOnRead(Sender : TObject; const EventRec : TStNTEventLogRec; var Abort : Boolean);
|
63 |
begin
|
64 |
Inc(ReadCount);
|
65 |
end;
|
66 |
|
67 |
procedure TForm1.Button1Click(Sender: TObject);
|
68 |
var
|
69 |
I : Integer;
|
70 |
begin
|
71 |
EL.OnReadRecord := MyOnRead;
|
72 |
Label1.Caption := IntToStr(EL.LogCount);
|
73 |
for I := 0 to EL.LogCount-1 do
|
74 |
Listbox1.Items.Add(EL.Logs[I]);
|
75 |
Label2.Caption := IntToStr(EL.RecordCount);
|
76 |
EL.ReadLog(True);
|
77 |
Label3.Caption := IntToStr(ReadCount);
|
78 |
end;
|
79 |
|
80 |
end.
|