Loading
How to get string array from .Net method in InstallScript
I have a method in .net with the following signature:

 

public long GetList(out string[] resultList){...}

 

How do I get the result in Install script?

 

I create the object using DotNetCoCreateObject() and call the method as follows:

 

function foo()

 

STRING resultList();

 

OBJECT dotNetObj;

 

NUMBER nResult;

 

begin

 

dotNetObj = DotNetCoCreateObject(...);

 

nResult = dotNetObj.GetList(resultList);

 

end;

 

the method returns but the resultList I got is always empty.

 

I tried with different Data Types: OBJECT, VARIENT, POINTER, LPSTR, LIST

 

all result in "parameter incorrect" exception.

 

if I pre-define the size of the string array: STRING resultList(5), the result is still empte array of size 5.

 

Thanks,

 

Homa Wong

  • InstallScript string arrays are safe arrays, therefore you would probably have to change your COM object to interpret this as a safe array.

     

    Devin Ellingson

     

    Software Developer

     

    Acresso Software
    Expand Post
  • You could also try GetCHARArrayFromISStringArray etc. to convert the array.

     

    Devin Ellingson

     

    Software Developer

     

    Acresso Software
    Expand Post
  • Are you trying to throw the string array into a LIST object?

     

    If so you, you can do it like this:

     

     

    InstallShield

     

     

    if(nDomainList <= 0) then

     

    nDomainList = ListCreate(STRINGLIST);

     

    endif;

     

    StrGetTokens(nDomainList, Installer.GetStuff(), ",");

     

     

    C

     

    [CODE]

     

    private string ToStringList(ArrayList TargetList)

     

    {

     

    return String.Join(",", (string[])TargetList.ToArray(typeof(string)));

     

    }

     

    [/CODE]

     

    In the case above, I joined an ArrayList into a single comma separated string and passed that back to InstallShield. You can modify the above to fit most collections and InstallShield uses them easily.
    Expand Post
  • Just google or search my blog for DTF ( Deployment Tools Foundation ) ... there's lot's of articles out there.

Loading
How to get string array from .Net method in InstallScript