我需要创建一个Wix安装程序,它允许我有一个对话框,用户可以输入序列号,然后我需要将他们输入的序列号保存到Windows注册表中。
此外,如果他们没有输入序列号,则需要禁用下一个按钮,以便他们无法继续安装,如果他们没有输入序列号。
答案 0 :(得分:2)
WIX不支持您想要的关键事件,当用户输入密钥时必须启用下一个按钮。最好的选择是提供下一个按钮并调用自定义操作来检查密钥是否正确,如果不正确抛出错误消息。
<Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="OrganizationLabel" Type="Text" X="45" Y="80" Width="100" Height="15" TabSkip="no" Text="&Organization:" />
<Control Id="OrganizationEdit" Type="Edit" X="45" Y="95" Width="220" Height="18" Property="COMPANYNAME" Text="{80}" />
<Control Id="CDKeyLabel" Type="Text" X="45" Y="125" Width="50" Height="10" TabSkip="no">
<Text>License &Key:</Text>
</Control>
<Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="140" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back">
<Publish Event="NewDialog" Value="[WixUI_UserRegistrationDlg_Back]">1</Publish>
</Control>
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
<Publish Event="ValidateProductID" Value="0">0</Publish>
<Publish Event="DoAction" Value="CheckingPID">1</Publish>
<Publish Event="SpawnDialog" Value="InvalidPidDlg">PIDACCEPTED = "0"</Publish>
<Publish Event="NewDialog" Value="[WixUI_UserRegistrationDlg_Next]">PIDACCEPTED = "1"</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
</Dialog>
<Dialog Id="InvalidPidDlg" Width="260" Height="85" Title="[ProductName] [Setup]" NoMinimize="yes">
<Control Id="Return" Type="PushButton" X="100" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="Ok">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30" TabSkip="no">
<Text>[USERERRMSG]</Text>
</Control>
</Dialog>
InvlaidPidDlg将显示错误消息。从自定义操作,您需要设置'USERERRMSG'的值
答案 1 :(得分:1)
查看this帖子,其中介绍了如何在基于Wix的安装程序中创建自定义对话框
答案 2 :(得分:1)