procedure SetIISDir(Dir,BieMing:string);

var

I:IADSContainer;

ADS:IADS;

begin

if ADSGetObject('IIS://localhost/w3svc',IID_IADSContainer,IUnkown(I))=S_OK then

begin

ADS :=IADS(I.GetObject('IISWebServer','1'));

if ADS.QueryInterface(IID_IADSContainer,I)=S_OK) then

begin

ADS :=IADS(I.GetObject('IISWebVirtualDir','Root');

if ADS.QueryInterface(IID_IADSContainer,I)=S_OK) then

begin

ADS :=IADS(I.Create('IISWebVirtualDir',BieMing));

ADS.Put('AccessRead','True');

ADS.Put('Path',Dir);

ADS.SetInfo;

end;

end;

end;