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

  1. unit UserProps;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   ComCtrls, StdCtrls, ExtCtrls, ImgList;
  8.  
  9. type
  10.   TpropUser = class(TFrame)
  11.     pc: TPageControl;
  12.     tsGeneral: TTabSheet;
  13.     tsGroups: TTabSheet;
  14.     Image1: TImage;
  15.     Bevel2: TBevel;
  16.     Bevel3: TBevel;
  17.     lFullName: TLabel;
  18.     lLastLogoff: TLabel;
  19.     lLastLogon: TLabel;
  20.     lCount: TLabel;
  21.     lComment: TLabel;
  22.     stLastLogoff: TStaticText;
  23.     stName: TEdit;
  24.     stFullName: TStaticText;
  25.     stLastLogon: TStaticText;
  26.     stCount: TStaticText;
  27.     Panel4: TPanel;
  28.     imgList: TImageList;
  29.     lv: TListView;
  30.     Bevel1: TBevel;
  31.     Label1: TLabel;
  32.     Label2: TLabel;
  33.     Label3: TLabel;
  34.     stNSA: TStaticText;
  35.     stSidType: TStaticText;
  36.     Label4: TLabel;
  37.     Label5: TLabel;
  38.     stDomain: TStaticText;
  39.     stLen: TStaticText;
  40.     eSID: TEdit;
  41.     eComment: TEdit;
  42.   private
  43.     FIndex: DWORD;
  44.     FAccounts: TObject;
  45.   public
  46.     property Accounts: TObject read FAccounts write FAccounts;
  47.     property UserIndex: DWORD read FIndex write FIndex;
  48.     procedure Refresh;
  49.   end;
  50.  
  51. implementation
  52.  
  53. uses MiTeC_AccountsNT;
  54.  
  55. {$R *.DFM}
  56.  
  57. { TpropUser }
  58.  
  59. procedure TpropUser.Refresh;
  60. var
  61.   i: integer;
  62.   sl: TStringList;
  63. begin
  64.   pc.ActivePage:=tsGeneral;
  65.   sl:=TStringList.Create;
  66.   with TAccounts(Accounts),Users[UserIndex]^ do begin
  67.     eSID.Text:=SID;
  68.     stNSA.Caption:=IntToStr(NumberOfSubAuths);
  69.     stSidType.Caption:=GetNameUseStr(SidType);
  70.     stLen.Caption:=IntToStr(SidLength);
  71.     stDomain.Caption:=Domain;
  72.     stName.Text:=Name;
  73.     stFullName.Caption:=Fullname;
  74.     eComment.Text:=Comment;
  75.     stLastLogon.Caption:=DateTimeToStr(LastLogon);
  76.     stLastLogoff.Caption:=DateTimeToStr(LastLogoff);
  77.     stCount.Caption:=Format('%d',[LogonCount]);
  78.     sl:=TStringList.Create;
  79.     GetUserLocalGroups('',Name,sl);
  80.     for i:=0 to sl.Count-1 do
  81.       with lv.Items.Add do begin
  82.         Caption:=sl[i];
  83.         ImageIndex:=1;
  84.       end;
  85.     sl.Free;  
  86.   end;
  87. end;
  88.  
  89. end.
  90.