This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: How to get string array from .Net method in InstallScript
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 27, 2008
08:29 PM
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
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
(6) Replies
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 30, 2008
04:29 AM
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
Devin Ellingson
Software Developer
Acresso Software
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 30, 2008
04:39 AM
You could also try GetCHARArrayFromISStringArray etc. to convert the array.
Devin Ellingson
Software Developer
Acresso Software
Devin Ellingson
Software Developer
Acresso Software
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 30, 2008
09:04 PM
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.
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.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 03, 2008
04:17 PM
Christopher Painter wrote:
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,
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 04, 2008
10:18 AM
Are you trying to throw the string array into a LIST object?
If so you, you can do it like this:
InstallShield
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.
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.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 04, 2008
08:10 PM
Just google or search my blog for DTF ( Deployment Tools Foundation ) ... there's lot's of articles out there.