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

How to get return values like SdAskDestPath

I am trying to create a custom dialog where I need to retrieve the value of the drive letter base on the selection of the user.

I need the function to accept parameters and return the drive letter. Should I put a STRING value in the prototype?

prototype CustomDialog();

function NUMBER CustomDialog( )



*********************************************

For example, the SdAskDestPath will return the szDir and nResult.

nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );

I need the szDir to be the drive letter.

*********************My code below******


prototype CustomDialog();
#include "ifx.h"

function NUMBER CustomDialog( )
NUMBER nReturn;
NUMBER nControl;
BOOL bDone;
HWND hwndDlg;
// variables for combo box list and current selection
LIST listDrives;
STRING svDrive, svNewPath,svReturnString,svSelection;
begin
nReturn = EzDefineDialog("CustomDialog", ISUSER, "CustomDialog", 0);

if (nReturn < 0) then
// Report an error; then terminate.
MessageBox ("Error in defining dialog box", SEVERE);
abort;
endif;

bDone = FALSE;

// create the list containing the combo box items
listDrives = ListCreate(STRINGLIST);
// fill the list with all available drive letters
GetValidDrivesList(listDrives, -1, -1);

while (!bDone)

nControl = WaitOnDialog("CustomDialog");

switch (nControl)

case DLG_CLOSE:
// The user clicked the window's Close button.
Do (EXIT);

case DLG_ERR:

MessageBox("Unable to show Dialog",SEVERE);

case RES_PBUT_BACK:
// user clicked Back
ListDestroy(listDrives);
nReturn = BACK;
bDone = TRUE;

case RES_PBUT_NEXT:

CtrlGetCurSel ("CustomDialog", RES_DIALOG_LISTBOX, svSelection);
MessageBox("Selection " + svSelection, SEVERE);

nReturn = NEXT;
bDone = TRUE;

case RES_PBUT_CANCEL:
// user clicked Cancel; ask user to verify cancellation
Do(EXIT);

case DLG_INIT:
hwndDlg = CmdGetHwndDlg ("CustomDialog");


CtrlDir ("CustomDialog", RES_DIALOG_LISTBOX, "*.*", DLG_DIR_DRIVE);


// ...cases for other controls...

endswitch;

endwhile;
Labels (1)
0 Kudos
(1) Reply
RobertDickau
Flexera Alumni

The InstallScript source files for the Sd dialog boxes is included with InstallShield, in the script\isrt\src directory or thereabouts; but yes, you'll generally see a BYREF STRING argument in the prototype for any dialog box that gets information back from the user (which is most of them).
0 Kudos