Google Groupes n'accepte plus les nouveaux posts ni abonnements Usenet. Les contenus de l'historique resteront visibles.

ADSI and DELPHI and IIS

5 vues
Accéder directement au premier message non lu

Chris Crowe [MVP]

non lue,
30 sept. 2000, 15:28:1430/09/2000
à
Hi,

I am trying to use ADSI to enumerate IIS objects from Delphi. I am
having problems because I assume that there should be certain objects
for specific IIS classes.

If I enumerate the W3SVC object, it returns different class's such as:

IIsWebInfo
IIsWebServer
IIsFilters

I can see this from the .class parameter but how do I access these
objects?

I assume there should be an object called IISWebServer defined in a type
library, but I do not know what type library to use to get the info for
it.

Does anyone have any ideas?

VB is so simple to use when dealing with ADSI compared to Delphi...

--

Chris Crowe
IISFAQ Web Site
www.IISFAQ.COM

James Dooley

non lue,
2 oct. 2000, 03:00:0002/10/2000
à

Hi There,

I've only started to work with ADSI last week, but here is a
small example of binding to my local IIS server and listing it's virtual
directories:

procedure TMainForm.btnListClick(Sender: TObject);
var
ADsContainer: IADsContainer;
EnumVariant : IEnumVariant;
Child : OleVariant;
Fetched : LongWord;
ADSIPath : WideString;
begin
Lst.Clear;

ADSIPath := 'IIS://localhost/W3SVC/1/ROOT';
OleCheck(ADsGetObject(PWideChar(ADSIPath), IADsContainer, ADsContainer));

// A Delphi For Each loop!
EnumVariant := ADsContainer._NewEnum as IEnumVariant;
EnumVariant.Reset;
Fetched := 0;
while Succeeded(EnumVariant.Next(1, Child, Fetched)) and (Fetched > 0) do
Lst.Items.Add(Child.Name);
end;

This code also shows how to do a Delphi version of VB's For Each loop. Note
that the Child variable is of type OleVariant, so you should be able to call
all
the methods and properties of the returned object, just as you would in VB.

I don't know if the classes you mention (IIsWebInfo, IIsWebServer,
IIsFilters)
are really COM interfaces or just ADSI classes. I can't find anything on
them.
There are however some interfaces defined in a type lib called ADSIIS.TLB
which
should be in your System32 directory. In any case since the Child variable
above
is declared as OleVariant you should not have to worry about referencing the
type lib.

You can download all my ADSI stuff at:

http://www.delphiworkshop.com/downloads/adsi_delphi.zip

Hope this helps,

James.

"Chris Crowe [MVP]" <ch...@iisfaq.com> wrote in message
news:MPG.144105fb9...@msnews.microsoft.com...

Chris Crowe [MVP]

non lue,
2 oct. 2000, 14:28:5502/10/2000
à

In article <OM3WXVF...@cppssbbsa02.microsoft.com>,
ja...@siteknowhow.com says...


Hi James,

Thanks for the info, I will try it out and see how I get on..

Chris

0 nouveau message