| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> delphi >> Delphi shen du tan suo - huo dong mu lu kai fa

Delphi shen du tan suo - huo dong mu lu kai fa

2006-11-24 00:50:15 编辑來源:互联网 评论
 
 
 
本文为【Delphi深度探索-活动目录开发】的拼音翻译版
  huo dong mu lu shi Windows NT 4.0 he Windows 2000 shi yong de mu lu fu wu 。 yao xiang shi yong huo dong mu lu fu wu , xu yao tiao yong ADSI( huo dong mu lu fu wu jie kou ) 。 ADSI shi yi zu yi COM jie kou de xing shi ti gong mu lu fu wu de , cheng xu yuan ke yi tong guo ADSI cun qu si zhong wang luo mu lu jie gou : WinNT (Microsoft SAM shu ju ku ) 、 LDAP ( qing liang mu lu cun qu xie yi ) 、 NDS (NetWare mu lu fu wu ) he NWCOMPAT (Novell NetWare 3.x) 。
   ADSI ke yi shi Windows NT guan li yuan de gong zuo bian de qing song 。 ADSI zhi chi guan li yuan zhi xing yi xie yi ban de guan li ren wu , bi ru tian jia xin yong hu 、 guan li da yin ji 、 an quan she ding he kong zhi NT yu 。 yin wei ADSI shi yong COM jie kou , ren he zhi chi COM de bian cheng yu yan xiang Delphi 、 BCB 、 VB 、 VC deng dou ke yi tiao yong ADSI 。
  
Delphi深度探索-活动目录开发

   tu 1.111
   huo dong mu lu yun xing zai Windows NT 4.0 he Windows 2000 shang 。 ke hu duan cheng xu ke yi yun xing zai Windows 95 、 Windows 98 、 Windows NT 4.0 he Windows 2000 shang 。 wei le shi yong ADSI , bi xu an zhuang ADSI COM jie kou 。 ADSI 2.5 SDK ke yi cong Microsoft ADSI wang zhi [url=http://www.pccode.net] xia zai "http://www.microsoft.com/adsi xia zai 。 SDK bao kuo wen dang 、 zai xian bang zhu he hen duo li zi , bu guo bu xing de shi zhe xie li zi dou shi zhen dui VB he VC de , zhe li wo men jiang yan shi ru he shi yong Delphi tiao yong ADSI 。
   cheng xu yan shi
   tu 1.111 suo shi de cheng xu yan shi le ru he tiao yong WinNT provider ti gong de gong neng 。 yan shi cheng xu yong lai lian jie dao yi ge yu , yi dan lian jie dao yu , cheng xu jiang hui lie chu zai PDC shang zhao dao de NT de yong hu he zu yi ji yu zhong de ji suan ji 。 tong shi zhe ge cheng xu huan yan shi le ru he cha kan yu zhong ji suan ji shang de fu wu he cha kan 、 tian jia 、 shan chu NT zu zhong de yong hu 。
   shi yong ADSI kong zhi Windows NT/2000
   ADSI ke yi shi wo men kong zhi yong hu 、 zu 、 ji suan ji 、 wen jian gong xiang 、 da yin ren wu 、 da yin dui lie he fu wu deng xi tong zi yuan 。 yao xiang zai Delphi zhong tiao yong ADSI , xu yao yin ru huo dong mu lu lei xing ku , tiao yong cai dan Project | Import Type Library ming ling , xuan ze ActiveDs (Version 1.0) dian que ren , Delphi hui sheng cheng xiang ying de feng zhuang wen jian 。
   bang ding Win NT mu lu fu wu
   lian jie Win NT mu lu fu wu jiu shi zhao dao yu kong zhi qi ran hou bang ding dao xiang ying de dui xiang shang 。 bang ding ke yi tong guo ADsGetObject huo ADsOpenObject han shu lai shi xian 。 ADsGetObject han shu sheng ming ru xia :
   function ADsGetObject(lpszPathName: PWideChar; const riid: TIID; out obj): HResult; stdcall; external 'activeds.dll';
   di yi ge shen shu shi dui xiang de lu jing ming , di er ge shen shu shi dui xiang de jie kou biao shi fu , di san ge shen shu yong yu fan hui de dao de bei qing qiu de jie kou zhi zhen 。 que sheng tiao jian xia , han shu gen ju dang qian yong hu jin xing an quan ren zheng 。
   ADsOpenObject han shu zai bu tong de an quan ren zheng ji zhi xia bang ding ADSI dui xiang , ta zhu yao shi tong guo tiao yong shen shu fan hui de yong hu ming he kou ling lai ren zheng de 。 han shu sheng ming ru xia :
   function ADsOpenObject(lpszPathName: PWideChar; lpszUserName: PWideChar; lpszPassword: PWideChar; dwReserved: LongInt; const riid: TIID; out obj): HResult; stdcall; external 'activeds.dll';
   di yi ge shen shu yi yi tong shang , di er 、 san ge shen shu shi tiao yong zhe ti gong de yong hu ming he kou ling , di si ge shen shu shi yi ge bao liu de provider biao shi , yong lai que ding bang ding de ren zheng fang fa , di wu ge shen shu shi qing qiu jie kou de jie kou biao shi fu , zui hou yi ge shen shu yong lai fan hui qing qiu de jie kou zhi zhen 。
   di yi ge han shu shi yong deng lu yong hu que sheng de xin ren ji bie , er di er ge han shu yuan xu kai fa zhe zhi ding te shu de an quan xin ren ji zhi lai bang ding ADSI dui xiang 。 xia mian dai ma yan shi le liang zhong bu tong de bang ding fang shi :
   procedure TMainFrm.actOpenWinNTExecute(Sender: TObject);
   var
   UnknownObject: IUnknown;
   DomainPath: WideString;
   Domain: IADsContainer;
   begin
   // zhi ding yu lu jing
   DomainPath := 'WinNT://' + ADSIDomainName.Text;
   // ru guo shi yong yong hu deng lu le xin xi
   if cbUseLogin.Checked then
   // shi yong yong hu deng lu de xin xi chuang jian yu dui xiang
   OleCheck(AdsOpenObject(PWideChar(DomainPath),
   PWideChar(ADSIUsername.Text),
   PWideChar(ADSIPassword.Text), 0, IID_IADsContainer,
   UnknownObject));
   else
   OleCheck(ADsGetObject(PWideChar(DomainPath),
   IID_IADsContainer, UnknownObject));
   // she ding yu dui xiang
   Domain := UnknownObject as IADsContainer;
   // cong yu zhong huo de xin xi lie biao
   GetDomainInformation(Domain);
   end;
   xia mian wo men xu yao sheng ming san ge bian liang :
   di yi ge shi jie kou bian liang , yong lai bang ding you zhi ding de dui xiang lu jing fan hui de han shu 。
   UnknownObject: IUnknown;
   di er ge shen shu shi WideString lei xing de bian liang , yong lai zai bang ding han shu zhong chan sheng yi ge dui xiang lu jing 。
   DomainPath: WideString;
   di san shi yi ge IADsContainer jie kou lei xing bian liang , yong lai bao cun fan hui de jie kou bian liang 。
   Domain: IADsContainer;
   IADsContainer bian liang jiang bei yong lai cong zhi ding de ADSI dui xiang zhong huo de quan bu yong hu 、 zu he ji suan ji 。 dang ran ye ke yi shi yong IADsDomain lei xing de bian liang , dan ta bu shi he mei ju yu zhong de zi dui xiang 。
   xia mian zhi ding xiang yao huo de de dui xiang lu jing , ru guo yu ming shi "PRISMA" , yao xiang huo de ADSI dui xiang , jiu xu yao zhi ding lu jing wei "WinNT://PRISMA" :
   // she ding yu ming lu jing
   DomainPath := 'WinNT://' + ADSIDomainName.Text;
   xia mian dai ma shi yong bu tong de an quan ren zheng fang shi :
   // ru guo shi yong deng lu xin xi
   if cbUseLogin.Checked then
   // shi yong deng lu bing chuang jian yu dui xiang
   OleCheck(AdsOpenObject(PWideChar(DomainPath),
   PWideChar(ADSIUsername.Text),
   PWideChar(ADSIPassword.Text), 0, IID_IADsContainer,
   UnknownObject));
   else
   // chuang jian yu dui xiang
   OleCheck(ADsGetObject(PWideChar(DomainPath),
   IID_IADsContainer, UnknownObject));
   ran hou wo men huo qu IADsContainer zhi zhen , yi bian cha xun yu zhong de zi dui xiang :
   // huo qu yu dui xiang
   Domain := UnknownObject as IADsContainer;
   zui hou , ba IADsContainer jie kou zhi zhen zuo wei shen shu tiao yong lai huo de yu zhong de zi dui xiang :
   GetDomainInformation(Domain);
   zai yu zhong cha zhao
   yao xiang zai yu zhong cha zhao zi dui xiang , ke yi shi yong GetDomainInformation guo cheng , dai ma ru xia :
   // huo qu yu xin xi
   procedure TMainFrm.GetDomainInformation(
   Domain: IADsContainer);
   var
   Enum: IEnumVariant;
   ADsTempObj: OLEVariant;
   ADsObj: IADs;
   Value: LongWord;
   begin
   // qing kong yong hu 、 zu he ji suan ji lie biao
   UserListView.Items.Clear;
   GroupListView.Items.Clear;
   ComputerListView.Items.Clear;
   // huo qu mei ju dui xiang
   Enum := (Domain._NewEnum) as IEnumVariant;
   // li yong mei ju dui xiang cha zhao
   while (Enum.Next(1, ADsTempObj, Value) = S_OK) do begin
   // huo de lin shi dui xiang
   ADsObj := IUnknown(ADsTempObj) as IADs;
   // ru guo shi yong hu dui xiang
   if AdsObj.Class_ = 'User' then
   AddUserToList(ADsObj);
   // ru guo shi zu dui xiang
   if AdsObj.Class_ = 'Group' then
   AddGroupToList(ADsObj);
   // ru guo shi ji suan ji dui xiang
   if AdsObj.Class_ = 'Computer' then
   AddComputerToList(ADsObj);
   end;
   end;
   xia mian shi dui cheng xu liu cheng de xiang xi shuo ming , shou xian huo de mei ju dui xiang , bing fu zhi gei Enum bian liang :
   Enum := (Domain._NewEnum) as IEnumVariant;
   ran hou li yong mei ju bian liang jin xing cha zhao bing ba mei ge zi dui xiang fu zhi gei lin shi de OLEVariant dui xiang :
   while (Enum.Next(1, ADsTempObj, Value) = S_OK) do begin
   OLEVariant bian liang fu zhi gei ADSI dui xiang
   ADsObj := IUnknown(ADsTempObj) as IADs;
   huo de ADSI dui xiang hou , kai shi jian cha dui xiang lei , gen ju dui xiang lei bie ba ADSI fen bie chu li , bing ba bu tong ADSI dui xiang de shu xing tian jia dao ge zi de lie biao shi tu zhong qu :
   // ru guo shi yong hu dui xiang
   if AdsObj.Class_ = 'User' then
   AddUserToList(ADsObj);
   // ru guo shi zu dui xiang
   if AdsObj.Class_ = 'Group' then
   AddGroupToList(ADsObj);
   // ru guo shi ji suan ji dui xiang
  
Delphi深度探索-活动目录开发

   tu 1.112
   if AdsObj.Class_ = 'Computer' then AddComputerToList(ADsObj);
   yun xing jie guo ru tu 1.112 suo shi 。
   chuang jian huo shan chu ji suan ji yong hu
   tong guo WinNT provider , ke yi chuang jian huo shan chu yu zhong ren yi yi tai ji suan ji de yong hu , yao xiang chuang jian yi ge yu zhong zhi ding de ji suan ji de yong hu , xu yao bang ding dao zhi ding de ji suan ji shang 。 yi dan yao bang ding dao ji suan ji dui ying de ADSI rong qi dui xiang , jiu xu yao tiao yong Create fang fa 。 rong qi dui xiang de Create fang fa xu yao liang ge shen shu , yi ge shi yao chuang jian de ADSI dui xiang de lei bie , yi ge shi yao yong lai miao shu ADSI dui xiang de ming zi 。 tiao yong Create fang fa hou hui fan hui xin de ADSI dui xiang de yin yong shen kao , xia mian dai ma yan shi le ru he chuang jian yi ge yong hu :
   var
   ComputerObj: IADsContainer;
   TempUserObj: IUnknown;
   UserObj: IADsUser;
   PDCName: WideString;
   NewUserName: WideString;
   AdsPath: WideString;
   begin
   // huo qu yong hu xin xi
   PDCName := InputBox(' chuang jian xin yong hu ', ' qing shu ru yu ming : ', '');
   NewUserName := InputBox(' chuang jian xin yong hu ', ' qing shu ru yong hu ming : ', '');
   // zhi ding yu ming lu jing
   AdsPath := 'WinNT://' + PDCName + ',computer';
   // chuang jian ji suan ji dui xiang
   OleCheck(AdsGetObject(PWideChar(AdsPath),
   IID_IADsContainer, ComputerObj));
   // chuang jian xin yong hu
   TempUserObj := ComputerObj.Create('user', NewUserName);
   UserObj := TempUserObj as IADsUser;
   // she ding mu lu xin xi
   UserObj.SetInfo;
   // shua xin lie biao
   actOpenWinNT.Execute;
   shan chu yong hu ye fei chang lei si , zhi bu guo bu xu yao chuang jian ren he de yong hu dui xiang , ke zhi jie tiao yong rong qi dui xiang IADsContainer jie kou de Delete fang fa , Delete fang fa xu yao liang ge shen shu , di yi ge shi yao shan chu de dui xiang lei bie , di er ge shi dui xiang ming cheng , dai ma shi yi ru xia :
   var
   ComputerObj: IADsContainer;
   PDCName: WideString;
   UserName: WideString;
   AdsPath: WideString;
   begin
   // huo qu yong hu xin xi
   PDCName := InputBox(' shan chu yong hu ', ' qing shu ru yu ming ', '');
   UserName := InputBox(' shan chu yong hu ', ' qing shu ru yao shan chu de yong hu ming : ', '');
   if MessageDlg(' ni shi fou que xin yao shan chu yong hu : ' +UserName + ' ?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then
   begin
   // zhi ding yu ming lu jing
   AdsPath := 'WinNT://' + PDCName + ',computer';
   // chuang jian ji suan ji dui xiang
  
  [1] [2] xia yi ye 原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
huo dong mu lu shi Windows NT 4.0 he Windows 2000 shi yong de mu lu fu wu 。 yao xiang shi yong huo dong mu lu fu wu , xu yao tiao yong ADSI( huo dong mu lu fu wu jie kou ) 。 ADSI shi yi zu yi COM jie kou de xing shi ti gong mu lu fu wu de , cheng xu yuan ke yi tong guo ADSI cun qu si zhong wang luo mu lu jie gou : WinNT (Microsoft SAM shu ju ku ) 、 LDAP ( qing liang mu lu cun qu xie yi ) 、 NDS [url=http://www.pccode.net](Net[/url]Ware mu lu fu wu ) he NWCOMPAT (Novell[url=http://www.pccode.net] Net[/url]Ware 3.x) 。 ADSI ke yi shi Windows NT guan li yuan de gong zuo bian de qing song 。 ADSI zhi chi guan li yuan zhi xing yi xie yi ban de guan li ren wu , bi ru tian jia xin yong hu 、 guan li da yin ji 、 an quan she ding he kong zhi NT yu 。 yin wei ADSI shi yong COM jie kou , ren he zhi chi COM de bian cheng yu yan xiang Delphi 、 BCB 、 VB 、 VC deng dou ke yi tiao yong ADSI 。 [img]http://edu.pccode.net/article/UploadPic/200636155612778.png[/img] tu 1.111 huo dong mu lu yun xing zai Windows NT 4.0 he Windows 2000 shang 。 ke hu duan cheng xu ke yi yun xing zai Windows 95 、 Windows 98 、 Windows NT 4.0 he Windows 2000 shang 。 wei le shi yong ADSI , bi xu an zhuang ADSI COM jie kou 。 ADSI 2.5 SDK ke yi cong Microsoft ADSI wang zhi [url=http://www.microsoft.com/adsi][url=http://www.pccode.net] xia zai [/url]"http://www.microsoft.com/adsi [url=http://www.pccode.net] xia zai [/url] 。 SDK bao kuo wen dang 、 zai xian bang zhu he hen duo li zi , bu guo bu xing de shi zhe xie li zi dou shi zhen dui VB he VC de , zhe li wo men jiang yan shi ru he shi yong Delphi tiao yong ADSI 。 cheng xu yan shi tu 1.111 suo shi de cheng xu yan shi le ru he tiao yong WinNT provider ti gong de gong neng 。 yan shi cheng xu yong lai lian jie dao yi ge yu , yi dan lian jie dao yu , cheng xu jiang hui lie chu zai PDC shang zhao dao de NT de yong hu he zu yi ji yu zhong de ji suan ji 。 tong shi zhe ge cheng xu huan yan shi le ru he cha kan yu zhong ji suan ji shang de fu wu he cha kan 、 tian jia 、 shan chu NT zu zhong de yong hu 。 shi yong ADSI kong zhi Windows NT/2000 ADSI ke yi shi wo men kong zhi yong hu 、 zu 、 ji suan ji 、 wen jian gong xiang 、 da yin ren wu 、 da yin dui lie he fu wu deng xi tong zi yuan 。 yao xiang zai Delphi zhong tiao yong ADSI , xu yao yin ru huo dong mu lu lei xing ku , tiao yong cai dan Project | Import Type Library ming ling , xuan ze ActiveDs (Version 1.0) dian que ren , Delphi hui sheng cheng xiang ying de feng zhuang wen jian 。 bang ding Win NT mu lu fu wu lian jie Win NT mu lu fu wu jiu shi zhao dao yu kong zhi qi ran hou bang ding dao xiang ying de dui xiang shang 。 bang ding ke yi tong guo ADsGetObject huo ADsOpenObject han shu lai shi xian 。 ADsGetObject han shu sheng ming ru xia : function ADsGetObject(lpszPathName: PWideChar; const riid: TIID; out obj): HResult; stdcall; external 'activeds.dll'; di yi ge shen shu shi dui xiang de lu jing ming , di er ge shen shu shi dui xiang de jie kou biao shi fu , di san ge shen shu yong yu fan hui de dao de bei qing qiu de jie kou zhi zhen 。 que sheng tiao jian xia , han shu gen ju dang qian yong hu jin xing an quan ren zheng 。 ADsOpenObject han shu zai bu tong de an quan ren zheng ji zhi xia bang ding ADSI dui xiang , ta zhu yao shi tong guo tiao yong shen shu fan hui de yong hu ming he kou ling lai ren zheng de 。 han shu sheng ming ru xia : function ADsOpenObject(lpszPathName: PWideChar; lpszUserName: PWideChar; lpszPassword: PWideChar; dwReserved: LongInt; const riid: TIID; out obj): HResult; stdcall; external 'activeds.dll'; di yi ge shen shu yi yi tong shang , di er 、 san ge shen shu shi tiao yong zhe ti gong de yong hu ming he kou ling , di si ge shen shu shi yi ge bao liu de provider biao shi , yong lai que ding bang ding de ren zheng fang fa , di wu ge shen shu shi qing qiu jie kou de jie kou biao shi fu , zui hou yi ge shen shu yong lai fan hui qing qiu de jie kou zhi zhen 。 di yi ge han shu shi yong deng lu yong hu que sheng de xin ren ji bie , er di er ge han shu yuan xu kai fa zhe zhi ding te shu de an quan xin ren ji zhi lai bang ding ADSI dui xiang 。 xia mian dai ma yan shi le liang zhong bu tong de bang ding fang shi : procedure TMainFrm.actOpenWinNTExecute(Sender: TObject); var UnknownObject: IUnknown; DomainPath: WideString; Domain: IADsContainer; begin // zhi ding yu lu jing DomainPath := 'WinNT://' + ADSIDomainName.Text; // ru guo shi yong yong hu deng lu le xin xi if cbUseLogin.Checked then // shi yong yong hu deng lu de xin xi chuang jian yu dui xiang OleCheck(AdsOpenObject(PWideChar(DomainPath), PWideChar(ADSIUsername.Text), PWideChar(ADSIPassword.Text), 0, IID_IADsContainer, UnknownObject)); else OleCheck(ADsGetObject(PWideChar(DomainPath), IID_IADsContainer, UnknownObject)); // she ding yu dui xiang Domain := UnknownObject as IADsContainer; // cong yu zhong huo de xin xi lie biao GetDomainInformation(Domain); end; xia mian wo men xu yao sheng ming san ge bian liang : di yi ge shi jie kou bian liang , yong lai bang ding you zhi ding de dui xiang lu jing fan hui de han shu 。 UnknownObject: IUnknown; di er ge shen shu shi WideString lei xing de bian liang , yong lai zai bang ding han shu zhong chan sheng yi ge dui xiang lu jing 。 DomainPath: WideString; di san shi yi ge IADsContainer jie kou lei xing bian liang , yong lai bao cun fan hui de jie kou bian liang 。 Domain: IADsContainer; IADsContainer bian liang jiang bei yong lai cong zhi ding de ADSI dui xiang zhong huo de quan bu yong hu 、 zu he ji suan ji 。 dang ran ye ke yi shi yong IADsDomain lei xing de bian liang , dan ta bu shi he mei ju yu zhong de zi dui xiang 。 xia mian zhi ding xiang yao huo de de dui xiang lu jing , ru guo yu ming shi "PRISMA" , yao xiang huo de ADSI dui xiang , jiu xu yao zhi ding lu jing wei "WinNT://PRISMA" : // she ding yu ming lu jing DomainPath := 'WinNT://' + ADSIDomainName.Text; xia mian dai ma shi yong bu tong de an quan ren zheng fang shi : // ru guo shi yong deng lu xin xi if cbUseLogin.Checked then // shi yong deng lu bing chuang jian yu dui xiang OleCheck(AdsOpenObject(PWideChar(DomainPath), PWideChar(ADSIUsername.Text), PWideChar(ADSIPassword.Text), 0, IID_IADsContainer, UnknownObject)); else // chuang jian yu dui xiang OleCheck(ADsGetObject(PWideChar(DomainPath), IID_IADsContainer, UnknownObject)); ran hou wo men huo qu IADsContainer zhi zhen , yi bian cha xun yu zhong de zi dui xiang : // huo qu yu dui xiang Domain := UnknownObject as IADsContainer; zui hou , ba IADsContainer jie kou zhi zhen zuo wei shen shu tiao yong lai huo de yu zhong de zi dui xiang : GetDomainInformation(Domain); zai yu zhong cha zhao yao xiang zai yu zhong cha zhao zi dui xiang , ke yi shi yong GetDomainInformation guo cheng , dai ma ru xia : // huo qu yu xin xi procedure TMainFrm.GetDomainInformation( Domain: IADsContainer); var Enum: IEnumVariant; ADsTempObj: OLEVariant; ADsObj: IADs; Value: LongWord; begin // qing kong yong hu 、 zu he ji suan ji lie biao UserListView.Items.Clear; GroupListView.Items.Clear; ComputerListView.Items.Clear; // huo qu mei ju dui xiang Enum := (Domain._NewEnum) as IEnumVariant; // li yong mei ju dui xiang cha zhao while (Enum.Next(1, ADsTempObj, Value) = S_OK) do begin // huo de lin shi dui xiang ADsObj := IUnknown(ADsTempObj) as IADs; // ru guo shi yong hu dui xiang if AdsObj.Class_ = 'User' then AddUserToList(ADsObj); // ru guo shi zu dui xiang if AdsObj.Class_ = 'Group' then AddGroupToList(ADsObj); // ru guo shi ji suan ji dui xiang if AdsObj.Class_ = 'Computer' then AddComputerToList(ADsObj); end; end; xia mian shi dui cheng xu liu cheng de xiang xi shuo ming , shou xian huo de mei ju dui xiang , bing fu zhi gei Enum bian liang : Enum := (Domain._NewEnum) as IEnumVariant; ran hou li yong mei ju bian liang jin xing cha zhao bing ba mei ge zi dui xiang fu zhi gei lin shi de OLEVariant dui xiang : while (Enum.Next(1, ADsTempObj, Value) = S_OK) do begin OLEVariant bian liang fu zhi gei ADSI dui xiang ADsObj := IUnknown(ADsTempObj) as IADs; huo de ADSI dui xiang hou , kai shi jian cha dui xiang lei , gen ju dui xiang lei bie ba ADSI fen bie chu li , bing ba bu tong ADSI dui xiang de shu xing tian jia dao ge zi de lie biao shi tu zhong qu : // ru guo shi yong hu dui xiang if AdsObj.Class_ = 'User' then AddUserToList(ADsObj); // ru guo shi zu dui xiang if AdsObj.Class_ = 'Group' then AddGroupToList(ADsObj); // ru guo shi ji suan ji dui xiang [img]http://www.chinamx.com.cn/Article/UploadFiles/200605/2006530121411982.jpg[/img] tu 1.112 if AdsObj.Class_ = 'Computer' then AddComputerToList(ADsObj); yun xing jie guo ru tu 1.112 suo shi 。 chuang jian huo shan chu ji suan ji yong hu tong guo WinNT provider , ke yi chuang jian huo shan chu yu zhong ren yi yi tai ji suan ji de yong hu , yao xiang chuang jian yi ge yu zhong zhi ding de ji suan ji de yong hu , xu yao bang ding dao zhi ding de ji suan ji shang 。 yi dan yao bang ding dao ji suan ji dui ying de ADSI rong qi dui xiang , jiu xu yao tiao yong Create fang fa 。 rong qi dui xiang de Create fang fa xu yao liang ge shen shu , yi ge shi yao chuang jian de ADSI dui xiang de lei bie , yi ge shi yao yong lai miao shu ADSI dui xiang de ming zi 。 tiao yong Create fang fa hou hui fan hui xin de ADSI dui xiang de yin yong shen kao , xia mian dai ma yan shi le ru he chuang jian yi ge yong hu : var ComputerObj: IADsContainer; TempUserObj: IUnknown; UserObj: IADsUser; PDCName: WideString; NewUserName: WideString; AdsPath: WideString; begin // huo qu yong hu xin xi PDCName := InputBox(' chuang jian xin yong hu ', ' qing shu ru yu ming : ', ''); NewUserName := InputBox(' chuang jian xin yong hu ', ' qing shu ru yong hu ming : ', ''); // zhi ding yu ming lu jing AdsPath := 'WinNT://' + PDCName + ',computer'; // chuang jian ji suan ji dui xiang OleCheck(AdsGetObject(PWideChar(AdsPath), IID_IADsContainer, ComputerObj)); // chuang jian xin yong hu TempUserObj := ComputerObj.Create('user', NewUserName); UserObj := TempUserObj as IADsUser; // she ding mu lu xin xi UserObj.SetInfo; // shua xin lie biao actOpenWinNT.Execute; shan chu yong hu ye fei chang lei si , zhi bu guo bu xu yao chuang jian ren he de yong hu dui xiang , ke zhi jie tiao yong rong qi dui xiang IADsContainer jie kou de Delete fang fa , Delete fang fa xu yao liang ge shen shu , di yi ge shi yao shan chu de dui xiang lei bie , di er ge shi dui xiang ming cheng , dai ma shi yi ru xia : var ComputerObj: IADsContainer; PDCName: WideString; UserName: WideString; AdsPath: WideString; begin // huo qu yong hu xin xi PDCName := InputBox(' shan chu yong hu ', ' qing shu ru yu ming ', ''); UserName := InputBox(' shan chu yong hu ', ' qing shu ru yao shan chu de yong hu ming : ', ''); if MessageDlg(' ni shi fou que xin yao shan chu yong hu : ' +UserName + ' ?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin // zhi ding yu ming lu jing AdsPath := 'WinNT://' + PDCName + ',computer'; // chuang jian ji suan ji dui xiang [1] [url=http://www.chinamx.com.cn/Article/os/win2003/200605/20060530121411_27207_2.html][2][/url] [url=http://www.chinamx.com.cn/Article/os/win2003/200605/20060530121411_27207_2.html] xia yi ye [/url]
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
玉美人_珠联璧合
清纯美女米卡
清新靓丽的早晨
玲子的自信与性感
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有