View Full Version : Returning a value in a function

06-26-2008, 12:45 PM
Hey there,

I've successfully created a custom dialog and actually got the thing to display. Now I need to return a value.

I've been looking at the examples and most functions return an interger or code which informs the calling method that the user hit back.

What I don't understand (yet) is how some functions return values.

Here's an example:

// Parameters that get passed into the function
szName = ""
szTitle = ""

// Parameters that get returned
// svVariable
// svVariable2

MyFunction(szName, szTitle, svVariable, svVariable2);

How in the world do I populate svVariable and svVariable2 in my custom function? Is it cheating by using the global variables above? If so, then why would I need to pass those values in in the first place?

There has to be something I am missing, but I haven't found the solution yet.

Any help is appreciated.


06-26-2008, 12:55 PM
It is setting the global variable.....


So then why pass it in the first place?

06-26-2008, 01:11 PM
You'll want to look into "BYREF" arguments passed to your function; the source code for the Sd dialog boxes (in the Script/isrt/src folder or thereabouts in your InstallShield distribution) should have many examples.

06-26-2008, 01:17 PM
Ah that explains my incorrect syntax with it.

After I hit post, I remembered that keyword.

I see you only call BYREF in the prototype call, not the actual function call. That was my mistake, thanks a bunch!