
hwong1.5524916634781938E12 asked a question.
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
Devin Ellingson
Software Developer
Acresso Software
Devin Ellingson
Software Developer
Acresso Software
http://blog.deploymentengineering.com/2006/08/more-fun-with-cocreateobjectdotnet.html
I don't really roll this way anymore though. I prefer to use DTF so that my C code can simply interact with MSI properties with no code in the middle to drive it.
This is an old article but you might want to check out:
http://blog.deploymentengineering.com/2006/08/more-fun-with-cocreateobjectdotnet.html
I don't really roll this way anymore though. I prefer to use DTF so that my C code can simply interact with MSI properties with no code in the middle to drive it. "
That sounds cool. What is DTF? Can you point me to some articles?
Thanks,
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.