cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
m_rudolph
Level 6

EnterDisk Question

I'm attempting to prompt a user for a SQL Server 2005 CD by using EnterDisk during OnMoved().

Some problems I can forsee is, if the customer already owns SQL Server 2005, then any key file I can provide wont exist. I would assume that I could just use a common file that exists on all SQL Server 2005 CDs for the key file, but maybe that's not 100% guaranteed.

The problem I'm assuming I will run into is that once they pass the EnterDisk prompt by providing a media that is valid, how can I call LaunchAppAndWait on the SQL Server 2005 installation if I don't know the source? EnterDisk does not return a value for the path that was browsed to. It could possibly be on a local drive and not a CD ROM.

In a perfect world we provide them with the CDs, the key file is always there, and I launch it from where I know it will be.

Any suggestions are welcome.
Labels (1)
0 Kudos
(5) Replies
gridman
Level 8

I assume you are doing an InstallScript project.

I haven't worked with an InstallScript project in a while, but why don't you look at the Sd dialog functions and use one that asks for a path, and have the user browse to the location of the SQL setup program? Then you would pass the path that is returned to LaunchAppAndWait() to run the SQL setup program.

Would that work for what you want to do?
0 Kudos
m_rudolph
Level 6

It would gridman. I guess the only problem is that I'm displaying this dialog well past the interview process (OnMoved), so the next/back button can't exist. Just OK or Cancel I suppose. The structure of the EnterDisk dialog is perfect if it just returned a string variable to me.

Maybe I can clone the dialog and edit out the buttons.
0 Kudos
gridman
Level 8

Is there a reason you are going to ask for the path to the SQL Server setup program in OnMoved? You could do it at the end of OnFirstUIAfter(), after everything in your installation program has been done. Just display the dialog to get the path from the user, then call LaunchAppAndWait with the NOWAIT option, and the SQL program would then start and your setup program would end.
0 Kudos
gridman
Level 8

You could try to use the SdAskDestPath() function. Before that, call the Disable() function with the BACKBUTTON parameter to disable the Back button, so they can't go back. Something like this:

Disable(BACKBUTTON);
SdAskDestPath(szTitle,szMsg,szPath,0);
LaunchAppAndWait(szPath,szCmdLine,LAAW_OPTION_NOWAIT);
0 Kudos
m_rudolph
Level 6

Thanks for the help grid.

I decided to just clone EnterDisk and used this custom function to return the value. If anyone needs to do something similar and finds this in a search:

// Dialog and control IDs. 
#define RES_SQL_DIALOG_ID 13399 // ID of dialog itself
#define RES_PBUT_OK 1 // ID of OK button
#define RES_PBUT_CANCEL 9 // ID of Cancel button
#define RES_PBUT_TEXT 4 //Text box
#define RES_PBUT_BROWSE 31 //Browse button

prototype SdPromptForCD(BYREF STRING);

function SdPromptForCD(szSQLDirectory)

STRING szDialogName, szEditBoxStatusText, szTreeControlStatusText, svDir;
NUMBER nDialog, nResult, nCmdValue, nId;
BOOL bDone;
HWND hInstance, hwndParent;

begin

// Specify a name to identify the custom dialog in this installation.
szDialogName = "SQL_CD_PROMPT";

nResult = EzDefineDialog (szDialogName, "", "", RES_SQL_DIALOG_ID);

if (nResult < 0) then

// Report an error; then terminate.

MessageBox ("Error in defining dialog", SEVERE);

abort;

endif;


// Initialize the indicator used to control the while loop.

bDone = FALSE;



// Loop until done.

repeat


// Display the dialog and return the next dialog event.

nCmdValue = WaitOnDialog(szDialogName);


// Respond to the event.

switch (nCmdValue)

case RES_PBUT_TEXT:

CtrlGetText( szDialogName, RES_PBUT_TEXT, szSQLDirectory );

case RES_PBUT_BROWSE:
svDir = SRCDIR;
SelectDirEx ( "", "", szEditBoxStatusText, szTreeControlStatusText, BIF_RETURNONLYFSDIRS, svDir );
CtrlSetText (szDialogName, RES_PBUT_TEXT, svDir);

case DLG_CLOSE:

// The user clicked the window's Close button.

Do (EXIT);

case DLG_ERR:

MessageBox ("Unable to display dialog. Setup canceled.", SEVERE);

abort;

case DLG_INIT: ;

CtrlSetText (szDialogName, RES_PBUT_TEXT, SRCDIR);

case RES_PBUT_CANCEL:

// The user clicked the Cancel button.

Do (EXIT);

case RES_PBUT_OK:

nId = NEXT;
bDone = TRUE;

endswitch;


until bDone;


// Close the dialog.

EndDialog (szDialogName);


// Free the dialog from memory.

ReleaseDialog (szDialogName);

return nId;

end;


Now just call SdPromptForCD(szSQLDirectory); and the szSQLDirectory variable can be passed to whatever; in my case, a batch file write.
0 Kudos