cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
slemieux
Level 4

.Net function call problem

Hi!

I'm calling an .net object created by DotNetCoCreateObject. The object is successfully created, but when I call one of its public methods, I get an "The parameter is incorrect." error.

Here is my code:

set oObj = DotNetCoCreateObject (SUPPORTDIR ^ "SetupDBHelper.dll", "SetupDBHelper.SqlServerHelper","");
nResult = oObj.Ping(sLogRepositoryConnString);

Any idea of what could be the problem?
Labels (1)
0 Kudos
(2) Replies
ChristopheOce
Level 7

Hi,

I'm a beginner with installshield, but for your problem have you declare the prototype of the function dot net you want to use => who is : SetupDBHelper.SqlServerHelper ?

If not, here is it a sample :


prototype TypeOfReturn SetupDBHelper.SqlServerHelper(YourParameter1, yourParameter2, ...);



Have a nice day
Christophe
0 Kudos
Christopher_Pai
Level 16

You probably want to replace SUPPORTDIR with a call to MsiGetProperty to get the SUPPORTDIR directory property.

Otherwise you seem to have the right concept. In your .NET code, declarate your class as ComVisible(true) and instantiate it by using the NameSpace.Class like you show. You might also want to use some try catch blocks cause if you try to invoke a member on an object that isn't valid, kaboom.

Btw my blog has lots of examples in this area.
0 Kudos