如何访问安装过程中输入的信息? (VS2008安装项目)

时间:2023-01-16 18:35:55

I added a simple dialog window to the install's UI with textboxes. How do I find out what the user entered?

我在带有文本框的安装UI中添加了一个简单的对话窗口。如何找出用户输入的内容?

@Mitch Wheat: Thank you. I managed to solve the problem with your help. But I think you failed to mention that I need to use the CustomActionData property of the Custom Action. 如何访问安装过程中输入的信息? (VS2008安装项目)

@Mitch Wheat:谢谢。我设法在你的帮助下解决了这个问题。但我认为你没有提到我需要使用Custom Action的CustomActionData属性。

1 个解决方案

#1


When you say " added a simple dialog window to the install's UI with textboxes", I'm assuming you added a custom action and associated installer class.

当您说“使用文本框向安装的UI添加一个简单的对话框窗口”时,我假设您添加了自定义操作和关联的安装程序类。

This snippet from this MSDN article, shows how:

这篇MSDN文章的片段展示了如何:

To create a custom action

创建自定义操作

  1. On the File menu, point to New, and then click Project.

    在“文件”菜单上,指向“新建”,然后单击“项目”。

  2. In the New Project dialog box, select Visual Basic in the Project Types pane, and then choose Class Library in the Templates pane. In the Name box, type PassData.

    在“新建项目”对话框中,在“项目类型”窗格中选择“Visual Basic”,然后在“模板”窗格中选择“类库”。在“名称”框中,键入PassData。

The project is added to Solution Explorer.

该项目已添加到Solution Explorer中。

To create an installer class

创建安装程序类

  1. On the Project menu, click Add Class.

    在“项目”菜单上,单击“添加类”。

    In the Add New Item dialog box, choose Installer Class. Accept the default name.

    在“添加新项”对话框中,选择“安装程序类”。接受默认名称。

  2. When the installer class appears on the design surface, right-click the design surface and click View Code to view the file contents in the code editor.

    当安装程序类出现在设计图面上时,右键单击设计图面并单击“查看代码”以在代码编辑器中查看文件内容。

  3. Add the following procedure to override the Install procedure of the base class

    添加以下过程以覆盖基类的Install过程

    Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)

    Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)

        MyBase.Install(stateSaver) 
        Dim myInput As String = Me.Context.Parameters.Item("Message") 
        If myInput Is Nothing Then 
            myInput = "There was no message specified"  
        End If 
        MsgBox(myInput) 
    End Sub
    

#1


When you say " added a simple dialog window to the install's UI with textboxes", I'm assuming you added a custom action and associated installer class.

当您说“使用文本框向安装的UI添加一个简单的对话框窗口”时,我假设您添加了自定义操作和关联的安装程序类。

This snippet from this MSDN article, shows how:

这篇MSDN文章的片段展示了如何:

To create a custom action

创建自定义操作

  1. On the File menu, point to New, and then click Project.

    在“文件”菜单上,指向“新建”,然后单击“项目”。

  2. In the New Project dialog box, select Visual Basic in the Project Types pane, and then choose Class Library in the Templates pane. In the Name box, type PassData.

    在“新建项目”对话框中,在“项目类型”窗格中选择“Visual Basic”,然后在“模板”窗格中选择“类库”。在“名称”框中,键入PassData。

The project is added to Solution Explorer.

该项目已添加到Solution Explorer中。

To create an installer class

创建安装程序类

  1. On the Project menu, click Add Class.

    在“项目”菜单上,单击“添加类”。

    In the Add New Item dialog box, choose Installer Class. Accept the default name.

    在“添加新项”对话框中,选择“安装程序类”。接受默认名称。

  2. When the installer class appears on the design surface, right-click the design surface and click View Code to view the file contents in the code editor.

    当安装程序类出现在设计图面上时,右键单击设计图面并单击“查看代码”以在代码编辑器中查看文件内容。

  3. Add the following procedure to override the Install procedure of the base class

    添加以下过程以覆盖基类的Install过程

    Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)

    Public Overrides Sub Install(ByVal stateSaver As System.Collections.IDictionary)

        MyBase.Install(stateSaver) 
        Dim myInput As String = Me.Context.Parameters.Item("Message") 
        If myInput Is Nothing Then 
            myInput = "There was no message specified"  
        End If 
        MsgBox(myInput) 
    End Sub