cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ChristopheOce
Level 7

write a function who take some parameters !?

Hi,

I work with installshield 2008 and my project is a basic msi project

I have write a fonction test who just return a value


function string ReturnTest(hMSI)

begin

return "hello";
end;


that works if i use this function i can have the result in a messagebox but now

i would like to place this return value in the others function as this for example ;


function ResultTest(STRING)

begin
//Use the string HERE
end;


but when i compile the code that doesn't work at all !
C:\InstallShield 2008 Projects\SQLCONNECT_Insert\script files\setup.rul(84) : error C8003: 'ResultTest' : function has no prototype declaration
C:\InstallShield 2008 Projects\SQLCONNECT_Insert\script files\setup.rul(84) : error C8008: 'STRING' : identifier expected
Is it possible to pass some parameters in a function ?


Thanks in advance
Christophe
Labels (1)
0 Kudos
(4) Replies
RobertDickau
Flexera Alumni

Please see the help topic "Prototyping Functions"; in general, a new function needs two pieces, as in:

prototype int FunctionName(STRING, NUMBER);

function FunctionName(szSomething, nSomethingElse)
STRING temp;
begin

// do something

return 0;
end;


If you want to define an InstallScript custom action function, though, please see "Writing Entry-Point Functions". The prototype must be:

export prototype ActionName(HWND);


and the function body:
function ActionName(hInstall)
begin

// do something

return ERROR_SUCCESS;
end;


To pass additional information back and forth between the installer and your InstallScript function, you'll need to use MsiGetProperty and MsiSetProperty.
0 Kudos
Gaurav
Level 3

I just tried this with success -

#include "ifx.h"

export prototype MyFunction(HWND);
export prototype MyFunction2(HWND,STRING);

STRING tmpStr;
function MyFunction(hMSI)
number nvInstallState, nvActionState;
begin
tmpStr = "Message";
MyFunction2(hMSI, tmpStr);
end;

function MyFunction2(hMSI, tmpStr)
begin
MessageBox (tmpStr, 0);
end;
0 Kudos
ChristopheOce
Level 7

Hi both,

thanks for you information

That's great

Have a nice day
Christophe
0 Kudos
Holger_G
Level 10

Indeed, nice catch 🙂
0 Kudos