線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1470
推到 Plurk!
推到 Facebook!

請問如何抓取windows下用戶群組及用戶

尚未結案
jonescn2001
一般會員


發表:1
回覆:8
積分:1
註冊:2003-03-16

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-07-04 19:39:40 IP:218.74.xxx.xxx 未訂閱
請問如何抓取windows下用戶群組及用戶
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-07-04 19:59:44 IP:61.216.xxx.xxx 未訂閱
引言: 請問如何抓取windows下用戶群組及用戶
使用 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=28828 TNetUsers可以做網路群組名稱與使用者列表 網海無涯,學無止境!
jonescn2001
一般會員


發表:1
回覆:8
積分:1
註冊:2003-03-16

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-07-04 20:28:53 IP:218.74.xxx.xxx 未訂閱
不知有無範例可以可以給我參考,thins
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-07-05 00:29:54 IP:61.216.xxx.xxx 未訂閱
引言: 不知有無範例可以可以給我參考,thins
該元件彙編者,也已附範例! 建議你先玩玩~ 下面是我用該元件做的樣子: < src="http://delphi.ktop.com.tw/download/upload\33505_lan.JPG"> 網海無涯,學無止境! 發表人 - qoo1234 於 2003/07/05 00:50:33
wushang
一般會員


發表:2
回覆:13
積分:13
註冊:2003-02-10

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-07-05 11:00:17 IP:218.16.xxx.xxx 未訂閱
通過組名得到網絡電腦名稱列表: function GetUsers(GroupName: String;var List : TStringList): boolean; var NetResource : TNetResource; Buf : Pointer; Count,BufSize,Res : DWord; Ind : Integer; lphEnum : THandle; Temp : TNetResourceArray; begin Result := false; List.Clear; FillChar(NetResource,Sizeof(NetResource),0); NetResource.lpRemoteName := @GroupName[1]; NetResource.dwDisplayType := RESOURCEDISPLAYTYPE_SERVER; NetResource.dwUsage := RESOURCEUSAGE_CONTAINER; NetResource.dwScope := RESOURCETYPE_DISK; res := WNetOpenEnum(RESOURCE_GLOBALNET,RESOURCETYPE_DISK,RESOURCEUSAGE_CONTAINER,@NetResource,lphEnum); if res<> no_error then Exit; while true do begin Count := $FFFFFFFF; BufSize := 8192; GetMem(Buf,BufSize); res := WNetEnumResource(lphEnum,Count,Pointer(Buf),BufSize); if res = error_no_more_ITEMS then break; if res <> no_error then Exit; Temp := tnetresourceArray(Buf); for Ind := 0 to Count-1 do begin List.Add(Temp^.lpRemoteName); Inc(Temp); end; end; res := WNetCloseEnum(lphEnum); if res<>No_error then Exit; result := true; freemem(Buf); end;
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-07-05 11:18:28 IP:61.216.xxx.xxx 未訂閱
 unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, NetUsers;    type
  TForm1 = class(TForm)
    NetUsers1: TNetUsers;
    Button1: TButton;
    ListBox1: TListBox;
    ListBox2: TListBox;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation    {$R *.DFM}    procedure TForm1.Button1Click(Sender: TObject);
begin
// 用戶群組
NetUsers1.GetServerList;
ListBox1.Clear;
ListBox1.Items.AddStrings(NetUsers1.List);    // 用戶 
NetUsers1.Server := ListBox1.Items[0];
NetUsers1.GetUserList;
ListBox2.Clear;
ListBox2.Items.AddStrings(NetUsers1.List);    end;    end.
網海無涯,學無止境!
jonescn2001
一般會員


發表:1
回覆:8
積分:1
註冊:2003-03-16

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-07-05 21:36:37 IP:211.138.xxx.xxx 未訂閱
untuser 無法使用,找不到netusers.pas.或NetUsers.dcu
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-07-05 23:17:59 IP:61.216.xxx.xxx 未訂閱
引言: untuser 無法使用,找不到netusers.pas.或NetUsers.dcu
Because did not install the flyup the fat and fat wrapping http://delphi.ktop.com.tw/topic.php?TOPIC_ID=28828 Can't use that example~~ < src="http://delphi.ktop.com.tw/download/upload\33223_qoo.gif">網海無涯,學無止境! 發表人 - qoo1234 於 2003/07/06 00:23:03
jonescn2001
一般會員


發表:1
回覆:8
積分:1
註冊:2003-03-16

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-07-06 00:42:25 IP:211.138.xxx.xxx 未訂閱
如果要抓本機呢
jonescn2001
一般會員


發表:1
回覆:8
積分:1
註冊:2003-03-16

發送簡訊給我
#10 引用回覆 回覆 發表時間:2003-07-06 00:46:38 IP:211.138.xxx.xxx 未訂閱
netuser 的demo 抓到是主機名,不是user
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#11 引用回覆 回覆 發表時間:2003-07-06 00:51:41 IP:61.216.xxx.xxx 未訂閱
引言: netuser 的demo 抓到是主機名,不是user
That possibility you ask wrong. oh! Possibility the matter that you want to ask: How to grab at the windows the sever the list of the user! < src="http://delphi.ktop.com.tw/download/upload\33223_qoo.gif">網海無涯,學無止境!
jonescn2001
一般會員


發表:1
回覆:8
積分:1
註冊:2003-03-16

發送簡訊給我
#12 引用回覆 回覆 發表時間:2003-07-06 00:54:38 IP:211.138.xxx.xxx 未訂閱
我是菜鳥,麻煩你一下
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#13 引用回覆 回覆 發表時間:2003-07-06 01:02:18 IP:61.216.xxx.xxx 未訂閱
Simple example:     
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;    type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation    {$R *.dfm}

Function GetUserFromWindows: string;
Var
  UserName    : string;
  UserNameLen : Dword;
Begin
  UserNameLen := 255;
  SetLength(userName, UserNameLen);
  If GetUserName(PChar(UserName), UserNameLen) Then
    Result := Copy(UserName,1,UserNameLen - 1)
  Else
    Result := 'Unknown';
End;    procedure TForm1.Button1Click(Sender: TObject);
begin
 label1.Caption:=GetUserFromWindows;
end;    end.
 
網海無涯,學無止境! 發表人 - qoo1234 於 2003/07/06 01:12:09
jonescn2001
一般會員


發表:1
回覆:8
積分:1
註冊:2003-03-16

發送簡訊給我
#14 引用回覆 回覆 發表時間:2003-07-06 01:32:33 IP:211.138.xxx.xxx 未訂閱
如果本機有10個用戶,要如何抓取,可否告知
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#15 引用回覆 回覆 發表時間:2003-07-06 01:34:09 IP:61.216.xxx.xxx 未訂閱
引言: 如果本機有10個用戶,要如何抓取,可否告知
Sorry!I don't know what do you say? 網海無涯,學無止境! 發表人 - qoo1234 於 2003/07/06 01:34:55
jonescn2001
一般會員


發表:1
回覆:8
積分:1
註冊:2003-03-16

發送簡訊給我
#16 引用回覆 回覆 發表時間:2003-07-06 01:45:49 IP:211.138.xxx.xxx 未訂閱
如我的電腦是 windows2000 pro ,如控制台的電腦管理中本機使用者及群組,我想抓取全部的使用者及群組
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#17 引用回覆 回覆 發表時間:2003-07-06 02:30:27 IP:61.216.xxx.xxx 未訂閱
只要取得HKEY_CURRENT_USER\Software\Microsoft\MS Setup (ACME)\User Info 的資料,即可得到使用名單。    簡單範例:
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;    type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation
  uses Registry;
{$R *.dfm}    procedure TForm1.Button1Click(Sender: TObject);
var 
 Reg: TRegistry;
begin 
 Reg := TRegistry.Create; 
 Reg.RootKey := HKEY_CURRENT_USER;
 Reg.OpenKey('\Software\Microsoft\MS Setup (ACME)\User Info', True); 
 edit1.text := Reg.ReadString('DefName');
 Reg.free;
end;     end.
網海無涯,學無止境! 發表人 - qoo1234 於 2003/07/06 03:14:19
jonescn2001
一般會員


發表:1
回覆:8
積分:1
註冊:2003-03-16

發送簡訊給我
#18 引用回覆 回覆 發表時間:2003-07-06 08:43:24 IP:211.138.xxx.xxx 未訂閱
那只能抓到本機的使用的user,並非全部
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#19 引用回覆 回覆 發表時間:2003-07-06 08:52:41 IP:61.216.xxx.xxx 未訂閱
引言: 那只能抓到本機的使用的user,並非全部
請檢查該註冊表的資料,自己練習! ~劇終~ < src="http://delphi.ktop.com.tw/download/upload\33223_qoo.gif">網海無涯,學無止境!
系統時間:2024-04-28 16:03:01
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!