Chinaunix首页 | 论坛 | 博客
  • 博客访问: 588512
  • 博文数量: 208
  • 博客积分: 3286
  • 博客等级: 中校
  • 技术积分: 1780
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-24 20:38
文章分类

全部博文(208)

文章存档

2012年(7)

2011年(28)

2010年(21)

2009年(76)

2008年(65)

2007年(11)

我的朋友

分类:

2009-03-27 18:21:05

AskDestPath

InstallShield 2009 » InstallScript Language Reference

The AskDestPath function displays a dialog that enables the end user to specify a destination folder for the files to be installed by your installation. The dialog also includes a Browse button that enables the end user to select an existing folder on the system.

To open the Choose Folder dialog from the Choose Destination Location dialog, the end user must click the Browse button. The Choose Folder dialog displays a list of all available folders. The end user can select an existing folder or enter a new folder name. If the end user enters the name of a folder that does not exist, a message box opens to enable the end user to create the folder.

    Note

    Note

  • Installations that run in silent mode should create the new folder if it does not exist before calling AskDestPath. This ensures that the confirmation dialog is not displayed. Without this step, two response files are required to handle the two possible conditions.
  • The folder selected by the end user must be writable; non-writable folders are not accepted. If you want the end user to be able to select folders that are not writable, call the AskPath function instead.

Syntax

AskDestPath ( szTitle, szMsg, svDir, nReserved );

Parameters

AskDestPath Parameters 

Parameter

Description

szTitle

Specifies the title of the dialog. To display the default title Choose Destination Location, pass a null string ("") in this parameter.

szMsg

Specifies the message to display in the dialog. To pass multiple lines of static text in this parameter, insert newline escape sequences ( \n ) where needed to break the line. To display the default instructions for this dialog, pass a null string ("") in this parameter.

svDir

Specifies the default path to display when the dialog is opened; returns the path to the folder selected by the end user.

Note

If the default folder specified by svDir does not already exist on the end user's system, it is not created unless the end user clicks the Browse button and follows the steps to create it from the Choose Folder dialog. Therefore, whenever you specify a default folder that you intend to use before calling (which creates the folder if necessary), you must call when AskDestPath returns in order to determine whether that folder exists. If it does not exist, call to create it on the end user's system. Note that is called automatically in an installation running an event-based script.

nReserved

The value of this parameter must be 0 (zero).

Return Values

AskDestPath Return Values 

Return Value

Description

NEXT (1)

Indicates that the end user clicked the Next button.

BACK (12)

Indicates that the end user clicked the Back button.

Additional Information

To view an example of this or other dialogs for your installation, use the Dialog Sampler. In InstallShield, on the Tools menu, point to InstallScript, then click Standard Dialog Sampler or Skinned Dialog Sampler.

See Also

 
 
 
 
 
 
 
PreviousNext
Help Library

AskPath Example

InstallShield 2009 » InstallScript Language Reference

Note

Note

To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.

/*-----------------------------------------------------------*\

*

* InstallShield Example Script

*

* Demonstrates the AskPath function.

*

* This script obtains the path to a folder on the

* end user's computer.  If the path does not exist, it creates

* a folder at that location if indicated by the

* end user.  Finally, it displays the selected path.

*

\*-----------------------------------------------------------*/

// Include Ifx.h for built-in InstallScript function prototypes.

#include "Ifx.h"

export prototype ExFn_AskPath(HWND);

function ExFn_AskPath(hMSI)

    STRING szMsg, svResultPath[101];

    BOOL bTargetDirOk;

begin

    // Disable the Back button in installation dialogs.

    Disable (BACKBUTTON);

    // Create the message to display in the AskPath dialog.

    szMsg = "Specify a folder for the application.";

    // Initialize valid path indicator.

    bTargetDirOk = FALSE;

    repeat

        // Get a path from the user.  The default path is

        // the current value of the system variable INSTALLDIR.

        if (AskPath (szMsg, INSTALLDIR, svResultPath) = NEXT) then

            // Does the path entered by the user exist on the

            // target system?

            if (ExistsDir (svResultPath) = 0) then

                // If it exists, set indicator to exit the loop.

                bTargetDirOk = TRUE;

            else

                // If the path doesn't exists, ask if it should be created.

                 if (AskYesNo ("Folder does not exist. Create it?",YES) = YES) then

                    // Attempt to create the folder (directory).

                    if (CreateDir (svResultPath) = 0) then

                        // If the folder was created, set indicator to exit the loop.

                        bTargetDirOk = TRUE;

                    else

                        // Inform the end user that the folder was not created.

                        MessageBox ("Unable to create " + svResultPath, WARNING);

                    endif;

                endif;

            endif;

        endif;

    until bTargetDirOk;

    // Display the name of the target folder.

    MessageBox ("The target folder is " + svResultPath, INFORMATION);

    // You'd also enable the Back button for subsequent dialogs.

    Enable (BACKBUTTON);

end;


InstallShield Help Library
5 June 2008
 | 
阅读(903) | 评论(0) | 转发(0) |
0

上一篇:AdminAskPath

下一篇:AskOptions

给主人留下些什么吧!~~