1

Wix ツールを使用して MSI インストーラーを作成するのは初めてです。ここに質問があります。これを解決する方法を教えてください。私のクエリは次のとおりです。カスタムUIを作成しました。これにはコンボボックスコントロールがあり、カスタムアクションメソッドを使用してコンボボックスの値を動的にバインドし、正常に動作しています。ここで、パラメーター (コンボ ボックスで選択した値) をカスタム アクション メソッドに渡したいのですが、パラメーターを渡す方法がわかりません。ゴーグルしましたが、答えが得られませんでした。

これが私のコードです

 <Binary Id="CustomActions" SourceFile="D:\WIX Projects\ExampleSetup\CustomAction1\bin\Debug\CustomAction1.CA.dll" />
<CustomAction Id='Action1' BinaryKey='CustomActions' DllEntry='FillServerInstances' Execute='immediate' Return='check' />
<UI>
  <Dialog Id="CustomWelcomeEulaDlg" Width="600" Height="450" Title="!(loc.WelcomeEulaDlg_Title)">
    <Control Id="Bitmap" Type="Bitmap" X="0" Y="44" Width="600" Height="380" TabSkip="no" Text="MainImage" />
    <Control Id="Next" Type="PushButton" X="290" Y="430" Width="60" Height="17" Default="yes" Text="Next">
      <Publish Event="DoAction" Value="Action1">1</Publish>
      <Publish Event="NewDialog" Value="LicenseAgreementDlgs"><![CDATA[1]]></Publish>
      <Publish Event="ReinstallMode" Value="ecmus"><![CDATA[Installed = 1]]></Publish>
    </Control>
    <Control Id="Cancel" Type="PushButton" X="350" Y="430" Width="56" Height="17" Cancel="yes" Text="Cancel">
      <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
    </Control>
    <Control Id="Title" Type="Text" X="15" Y="6" Width="300" Height="15" Transparent="yes" NoPrefix="yes">
      <Text>[DlgTitleFont]Welcome to the [ProductName] [Wizard]</Text>
    </Control>
    <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="600" Height="0" />
   </Dialog>

最新のコード

 <Product Id="22d32870-651b-4eee-a622-27b2daaade8c" Name="Small Business" Language="1033" Version="1.0.0.0" Manufacturer="Small Business Manufacturing" UpgradeCode="01b2dc2f-61f3-4ff0-a0ba-94dd4cb0829d">

      <Package InstallerVersion="200" Compressed="yes" />

      <Property Id="MSIFASTINSTALL" Value="3" />
        <Binary Id="BIN_CustomAction" SourceFile="D:\WIX Projects\ExampleSetup\CustomAction1\bin\Debug\CustomAction1.CA.dll"/>
        <Binary Id="myAction" SourceFile="D:\WIX Projects\ExampleSetup\CustomAction1\bin\Debug\CustomAction1.CA.dll"/>
       <UIRef Id="WixUI_CustomMinimal" />

        <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
         <Property Id="FILEPATH" />
                 <Directory Id="TARGETDIR" Name="SourceDir">
                 <Directory Id="ProgramFilesFolder">
                 <Directory Id="INSTALLLOCATION" Name="Small Business Manufacturing">
                   <Component Id="Component" Guid="af10d5b4-5d25-474f-8360-13b6c0cd7a53">
                    <File Id="Component" Source="D:\WIX Projects\Small Business Manufacturing\Small Business Manufacturing\bin\Debug\Myproject.exe" Compressed="yes" KeyPath="yes" Checksum="yes" />
                    </Component>

             </Directory>
             </Directory>
            </Directory>

                 <Feature Id="ProductFeature" Title="Installation Target" Level="1">
               <ComponentRef Id="Component" />
                </Feature>
                   <InstallExecuteSequence>
                  <Custom Action="myActionId" After="InstallFinalize"></Custom>
                  </InstallExecuteSequence>
              <CustomAction Id="SetCustomActionDataValue" Return="check" Property="myActionId" Value="AnotherValue=[Sqlinstaces]" />
        <UI>
          <ProgressText Action="RunEXE">Configuring Foo... (this may take a few minutes).</ProgressText>
        </UI>

      </Product>
4

1 に答える 1

3

私の知る限り、カスタム アクションにパラメーターを渡すことはできません。Wix でプロパティを設定し、それを使用WcaGetPropertyしてアクセスできます。

次のように似たリストボックスを使用します。

<!--This will be populated via the custom action-->
    <Control Id="ListBoxID" Type="ListBox" Property="COMPORT" Width="80" Height="40" X="80" Y="165" Indirect="no">
      <ListBox Property="COMPORT">
      </ListBox>
    </Control>

そして、私の C++ カスタム アクションでは:

hr = WcaGetFormattedProperty(L"COMPORT",&szComport);
ExitOnFailure(hr, "failed to get Com Port");

編集:

わかりましたので、ComboBox が次のようなものであると想定しています。

  <Control Id="DummyComboBox" Hidden="yes" Type="ComboBox" Sorted="yes" ComboList="yes" Property="DUMMYPROPERTY" X="65" Y="60" Width="150" Height="18">
  <ComboBox Property="DUMMYPROPERTY">
  </ComboBox>

プロパティが次のように定義されていることを確認してください(大文字であることを確認してください):

    <Property Id="DUMMYPROPERTY" Secure="yes"></Property>

プロパティの値を送信するためのカスタム アクションは必要ありません。あなたがしなければならないのは、使用することだけです:

LPWSTR dummyText = NULL;

hr = WcaGetProperty(L"DUMMYPROPERTY", &dummyText);
ExitOnFailure(hr, "failed to get Dummy Text");

これは、何を使用しているのかわからない C++ カスタム アクション用ですが、Google で簡単に検索すると、使用する関連コードが表示されます。

于 2012-11-14T12:58:21.773 に答える