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: Calling a .net function in install script
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
Jul 13, 2010
07:02 AM
Calling a .net function in install script
I am trying to invoke a function contained in a .net dll from install script.
I have a simple function in the .net class library as below
public void DisplayMessage(string message)
{
MessageBox.Show(message);
}
This class is set to ComVisible = true and on compiling results in TestLibrary.dll
In install script,
I have created a prototype for the function as below. This is the first line after the header declarations.
prototype void TestLibrary.DisplayMessage(STRING)
I am loading the dll, as below
UseDLL(dllPath)
// where dllPath refers to the path where dll resides in the install shield project. The dll has been added to the Support files under Behavior and Logic section.
The dll loads perfectly fine, which I have confirmed using the return parameter from the UseDLL function.
But when i do the below to invoke the function, the script throws an error.
TestLibrary.DisplayMessage(sValue); //sValue is set to appropriate text in the code.
Can anyone tell me what I might be doing wrongly.
I have tried by making the class static.
I have a simple function in the .net class library as below
public void DisplayMessage(string message)
{
MessageBox.Show(message);
}
This class is set to ComVisible = true and on compiling results in TestLibrary.dll
In install script,
I have created a prototype for the function as below. This is the first line after the header declarations.
prototype void TestLibrary.DisplayMessage(STRING)
I am loading the dll, as below
UseDLL(dllPath)
// where dllPath refers to the path where dll resides in the install shield project. The dll has been added to the Support files under Behavior and Logic section.
The dll loads perfectly fine, which I have confirmed using the return parameter from the UseDLL function.
But when i do the below to invoke the function, the script throws an error.
TestLibrary.DisplayMessage(sValue); //sValue is set to appropriate text in the code.
Can anyone tell me what I might be doing wrongly.
I have tried by making the class static.
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 13, 2010
12:14 PM
UseDLL and UnUseDLL are intended for C-callable DLLs; please see the help and links on the "DotNetCoCreateObject" topic for information about calling .NET methods from InstallScript.