Iis Inno设置枚举器

Iis Inno设置枚举器,iis,inno-setup,enumerate,Iis,Inno Setup,Enumerate,我试图使用WbemScripting.SWbemLocator对象枚举IIsWebServer的属性。我的目标是使用PascalScript代码检索网站的服务器绑定。在VBScript中,我有以下代码: Dim site, binding, url Set site = GetObject("IIS://localhost/W3SVC/1") For Each binding In site.ServerBindings url = binding Exit For Next I

我试图使用WbemScripting.SWbemLocator对象枚举IIsWebServer的属性。我的目标是使用PascalScript代码检索网站的服务器绑定。在VBScript中,我有以下代码:

Dim site, binding, url
Set site = GetObject("IIS://localhost/W3SVC/1")
For Each binding In site.ServerBindings
    url = binding
    Exit For
Next
If Left(url, 1) = ":" Then
    url = "localhost" & url
End If
If Right(url, 1) Then
    url = Left(url, Len(url) - 1)
End If
Set site = Nothing
我徒手编写了这段代码,所以可能不太准确,但我想用PascalScript以类似的方式编写。我一直关注的部分是服务器绑定的枚举。我已经尝试了很多方法来让它工作,在目前的情况下,我有以下PascalScript:

function GetWebSites() : Array of String;
var
    locatorObj, providerObj, nodeObj, appRoot: Variant;
    props : String;
begin
    locatorObj := CreateOleObject('WbemScripting.SWbemLocator');
    providerObj := locatorObj.ConnectServer(GetComputerNameString(), 'root/MicrosoftIISv2');
    nodeObj := providerObj.Get('IIsWebServer=''W3SVC/1''');

    props := nodeObj.Properties_;
    // How do I enumerate through the properties here?  Or, my actual goal is from this point how do I get the ServerBindings (or the first element in the ServerBindings array)?
结束

在JavaScript中,要获得服务器绑定,必须使用类似于以下内容的内容:

var e = new Enumerator(nodeObj.Properties_);
for (; ! e.atEnd(); e.moveNext()) {
    var prop = e.item();
    if (prop.Name == 'ServerBindings') {
        // Do something
    }
}

任何帮助都将不胜感激。谢谢。

很遗憾,Inno代码不支持本机进行COM枚举,但您可以通过使用帮助器DLL获得支持。有关详细信息,请参阅

但是,如果您只想访问一个已知的命名属性,只需这样做

nodeObj.ServerBindings

很遗憾,Inno代码不支持本机进行COM枚举,但您可以通过使用帮助器DLL获得支持。有关详细信息,请参阅

但是,如果您只想访问一个已知的命名属性,只需这样做

nodeObj.ServerBindings