cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
sligers
Level 3

Return Values - PLEASE HELP!

Hi,

I have an small function, which get the type of the current drive/dir ( INSTALLDIR ). For later proposes, I would like to return the value of var "svType".

I would like to use the return value for conditions for components - How it is possible ?

How can i overwrite an property ( Eigenschaften-Manager in German ) ?

Thanks.




//CODE ################

#include "isrt.h"
#include "iswi.h"

export prototype MyOnMoving(HWND);

NUMBER svType;

function MyOnMoving(hMSI)

_DISK_INFO di;
NUMBER nvResult;
NUMBER nResult;
STRING szInstalldir;
STRING szPerm;
STRING sType;

begin

di.szDiskPath = INSTALLDIR;
di.nInfoToQuery = DISK_INFO_QUERY_ALL;

nvResult = GetDiskInfo( &di );

if ( nvResult = ISERR_SUCCESS ) then

switch ( di.nDriveType )
case DRIVE_UNKNOWN:
svType = 0;
sType = "Unknown";
case DRIVE_NO_ROOT_DIR:
svType = 0;
sType = "No Root Dir";
case DRIVE_REMOVABLE:
svType = 1;
sType = "Removable";
case DRIVE_FIXED:
svType = 1;
sType = "Drive Fixed";
case DRIVE_REMOTE:
svType = 0;
sType = "Remote";
case DRIVE_CDROM:
svType = 0;
sType = "CDROM";
case DRIVE_RAMDISK:
svType = 1;
sType = "RAMDISK";
endswitch;

endif;
Labels (1)
0 Kudos
(2) Replies
Chikura
Level 3

--------------------------------------------------------------------------------

return
InstallShield 12 » InstallScript Language Reference

You can use the return statement to return a value from a user-defined function (if the function prototype does not specify a return type of void). When a return statement is encountered, program flow returns to the point at which the function was called. When used to return from a call to a user-defined function, the return statement can return a specified value to the caller.

The return value of most built-in functions will be either 0 (zero), indicating the success of the function, or a value less than zero (< 0), indicating failure. You can assign a number to the return value by using a return statement above the end statement in the function block, as shown below:

return -1;

end;

This attribute allows you to return the value of a local variable to the caller, even though the local variable itself is destroyed:

function MyFunction(ParamOne, ParamTwo)

NUMBER nNumber;

begin

nNumber = (ParamOne + ParamTwo);

// . . .

return nNumber;

end;
0 Kudos
sligers
Level 3

Chikura wrote:
--------------------------------------------------------------------------------

return
InstallShield 12 » InstallScript Language Reference

You can use the return statement to return a value from a user-defined function (if the function prototype does not specify a return type of void). When a return statement is encountered, program flow returns to the point at which the function was called. When used to return from a call to a user-defined function, the return statement can return a specified value to the caller.

The return value of most built-in functions will be either 0 (zero), indicating the success of the function, or a value less than zero (< 0), indicating failure. You can assign a number to the return value by using a return statement above the end statement in the function block, as shown below:

return -1;

end;

This attribute allows you to return the value of a local variable to the caller, even though the local variable itself is destroyed:

function MyFunction(ParamOne, ParamTwo)

NUMBER nNumber;

begin

nNumber = (ParamOne + ParamTwo);

// . . .

return nNumber;

end;



How can i call the function from installshield ?
0 Kudos