WiX: dynamically changing the status text during CustomAction

≡放荡痞女 提交于 2019-11-28 11:17:01

Deferred Custom Actions can call the MsiProcessMessage function. You can then use INSTALLMESSAGE_ACTIONSTART, INSTALLMESSAGE_ACTIONDATA and INSTALLMESSAGE_PROGRESS to publish messages up to the UI.

Another possibility would be to break your custom action up into smaller custom actions and use the ProgressText (ActionText table) to describe different phases of installation. ( Make each CA have a single responsibility. )

Sometimes when a CA does too much work it's hard to plan rollbacks correctly.

Obtaining Context Information for Deferred Execution Custom Actions

MsiProcessMessage function

Using C#/DTF it looks something like:

    using (Record record = new Record(0))
    {
        record.SetString(0, "foo");
        session.Message(InstallMessage.ActionData, record);
    }

The using statement disposes the record to free up the underlying MSI handles. The number of fields in the record and how you set the data is going to depend on the template defined in the ActionText table.

Greg Westerfield Jr

Chris has correctly explained how to send the message to ActionData from your CA, but if you are using InstallShield, make sure you create a label on the SetupProgress dialog and subscribe the ActionData text event to it. Simply, creating an ActionText event for a label is not enough as it will only display the CA description you create in the ActionText Table.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!