|
From: Peter T. <pe...@us...> - 2003-08-24 01:08:24
|
Update of /cvsroot/jvcl/dev/JVCL3/examples/JvNTEventLog
In directory sc8-pr-cvs1:/tmp/cvs-serv4702/JVCL3/examples/JvNTEventLog
Added Files:
EventViewer.dof EventViewer.dpr EventViewer.res
JvNTEventLogMainFormU.dfm JvNTEventLogMainFormU.pas
Log Message:
- Copied jvcl/devtools and jvcl/examples dev/JVCL3
- Copied JVCLConvert *.dat files to dev/JVCL3/converter
--- NEW FILE: EventViewer.dof ---
[Directories]
OutputDir=..\..\Bin
UnitOutputDir=..\..\Dcu
SearchPath=..\..\Source;..\..\Common
--- NEW FILE: EventViewer.dpr ---
program EventViewer;
uses
Forms,
JvNTEventLogMainFormU in 'JvNTEventLogMainFormU.pas' {JvNTEventLogMainForm};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TJvNTEventLogMainForm, JvNTEventLogMainForm);
Application.CreateForm(TJvNTEventLogMainForm, JvNTEventLogMainForm);
Application.Run;
end.
--- NEW FILE: EventViewer.res ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: JvNTEventLogMainFormU.dfm ---
object JvNTEventLogMainForm: TJvNTEventLogMainForm
Left = 248
Top = 128
Width = 613
Height = 476
Caption = 'Event Viewer'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Splitter1: TSplitter
Left = 89
Top = 38
Width = 4
Height = 413
end
object ButtonsPanel: TPanel
Left = 0
Top = 0
Width = 605
Height = 38
Align = alTop
BevelOuter = bvNone
TabOrder = 0
object btnRefresh: TButton
Left = 9
Top = 6
Width = 75
Height = 25
Caption = 'Refresh'
TabOrder = 0
end
end
object ListBox1: TListBox
Left = 0
Top = 38
Width = 89
Height = 413
Align = alLeft
ItemHeight = 13
TabOrder = 1
OnClick = ListBox1Click
end
object ListView1: TListView
Left = 93
Top = 38
Width = 512
Height = 413
Align = alClient
Columns = <
item
Caption = 'Type'
Width = 60
end
item
Caption = 'Date'
Width = 62
end
item
Caption = 'Time'
Width = 60
end
item
Caption = 'Source'
Width = 100
end
item
Caption = 'Category'
Width = 55
end
item
Caption = 'Event'
Width = 40
end
item
Caption = 'User'
Width = 70
end
item
Caption = 'Computer'
Width = 60
end>
RowSelect = True
SortType = stText
TabOrder = 2
ViewStyle = vsReport
end
object JvNTEventLog1: TJvNTEventLog
Active = False
Left = 40
Top = 48
end
end
--- NEW FILE: JvNTEventLogMainFormU.pas ---
unit JvNTEventLogMainFormU;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, ComCtrls, JvNTEventLog, JvComponent;
type
TJvNTEventLogMainForm = class(TForm)
btnRefresh: TButton;
ListBox1: TListBox;
ButtonsPanel: TPanel;
Splitter1: TSplitter;
ListView1: TListView;
JvNTEventLog1: TJvNTEventLog;
procedure FormCreate(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
private
{ Private declarations }
procedure ReadEvents;
end;
var
JvNTEventLogMainForm: TJvNTEventLogMainForm;
implementation
{$R *.dfm}
procedure TJvNTEventLogMainForm.FormCreate(Sender: TObject);
begin
JvNTEventLog1.ReadEventLogs(ListBox1.Items);
JvNTEventLog1.Active := True;
end;
procedure TJvNTEventLogMainForm.ListBox1Click(Sender: TObject);
begin
if ListBox1.ItemIndex > -1 then
begin
JvNTEventLog1.Active := false;
JvNTEventLog1.Log := ListBox1.Items[ListBox1.ItemIndex];
JvNTEventLog1.Source := ListBox1.Items[ListBox1.ItemIndex];
JvNTEventLog1.Active := True;
ReadEvents;
end;
end;
procedure TJvNTEventLogMainForm.ReadEvents;
var
item: TListItem;
begin
ListView1.Items.BeginUpdate;
Screen.Cursor := crHourGlass;
try
ListView1.Items.Clear;
JvNTEventLog1.First;
while not JvNTEventLog1.Eof do
begin
item := ListView1.Items.Add;
item.Caption := JvNTEventLog1.EventRecord.EventType;
item.SubItems.Add(DateToStr(JvNTEventLog1.EventRecord.DateTime));
item.SubItems.Add(TimeToStr(JvNTEventLog1.EventRecord.DateTime));
item.SubItems.Add(JvNTEventLog1.EventRecord.Source);
item.SubItems.Add(IntToStr(JvNTEventLog1.EventRecord.Category));
item.SubItems.Add(IntToStr(JvNTEventLog1.EventRecord.ID and $0FFFFFFF));
item.SubItems.Add(JvNTEventLog1.EventRecord.Username);
item.SubItems.Add(JvNTEventLog1.EventRecord.Computer);
JvNTEventLog1.Next;
end;
finally
ListView1.Items.EndUpdate;
Screen.Cursor := crDefault;
end;
end;
end.
|