home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 March / Chip_2002-03_cd1.bin / zkuste / delphi / kompon / d56 / MSYSINFO.ZIP / Demos / GUI / EventLogProps.pas < prev    next >
Pascal/Delphi Source File  |  2002-01-04  |  2KB  |  99 lines

  1. unit EventLogProps;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   ComCtrls, StdCtrls;
  8.  
  9. type
  10.   TpropEventLog = class(TFrame)
  11.     PageControl1: TPageControl;
  12.     tsEvent: TTabSheet;
  13.     lType: TLabel;
  14.     lTime: TLabel;
  15.     lDate: TLabel;
  16.     stType: TStaticText;
  17.     stTime: TStaticText;
  18.     stDate: TStaticText;
  19.     lComputer: TLabel;
  20.     lUser: TLabel;
  21.     stComputer: TStaticText;
  22.     stUser: TStaticText;
  23.     lID: TLabel;
  24.     lCatg: TLabel;
  25.     lSource: TLabel;
  26.     stID: TStaticText;
  27.     stCatg: TStaticText;
  28.     stSource: TStaticText;
  29.     mDesc: TMemo;
  30.     lDesc: TLabel;
  31.     mData: TMemo;
  32.     lData: TLabel;
  33.   private
  34.     FEvent: TObject;
  35.   public
  36.     property Event: TObject read FEvent write FEvent;
  37.     procedure Refresh;
  38.   end;
  39.  
  40. implementation
  41.  
  42. uses MiTeC_EventLogNT;
  43.  
  44. {$R *.DFM}
  45.  
  46. { TpropEventLog }
  47.  
  48. procedure TpropEventLog.Refresh;
  49. var
  50.   sl1,sl2: TStringList;
  51.   i,j,k: integer;
  52.   s1,s2: string;
  53. begin
  54.   with PLogRecord(Event)^ do begin
  55.     stDate.Caption:=DateToStr(Datetime);
  56.     stTime.Caption:=TimeToStr(Datetime);
  57.     stType.Caption:=EventTypes[EventType];
  58.     if Username='' then
  59.       stUser.Caption:='N/A'
  60.     else
  61.       stUser.Caption:=Username+'\'+Domain;
  62.     stComputer.Caption:=Computer;
  63.     stSource.Caption:=Source;
  64.     if Category='' then
  65.       stCatg.Caption:='None'
  66.     else
  67.       stCatg.Caption:=Category;
  68.     stID.Caption:=Format('%d',[EventID]);
  69.     mDesc.Text:=Description;
  70.     sl1:=TStringList.Create;
  71.     sl1.CommaText:=BinaryData;
  72.     sl2:=TStringList.Create;
  73.     sl2.CommaText:=CharData;
  74.     j:=0;
  75.     k:=0;
  76.     s1:='';
  77.     s2:='';
  78.     mData.Lines.Clear;
  79.     for i:=0 to sl1.Count-1 do begin
  80.       s1:=s1+' '+sl1[i];
  81.       s2:=s2+sl2[i];
  82.       Inc(j);
  83.       if j=8 then begin
  84.         mData.Lines.Add(IntToHex(k,4)+':'+s1+stringofchar(' ',3)+s2);
  85.         s1:='';
  86.         s2:='';
  87.         j:=0;
  88.         Inc(k,8);
  89.       end;
  90.     end;
  91.     if (j>0) then
  92.       mData.Lines.Add(IntToHex(k,4)+':'+s1+stringofchar(' ',3)+s2);
  93.     sl1.Free;
  94.     sl2.Free;
  95.   end;
  96. end;
  97.  
  98. end.
  99.