I am stuck with this from quite long now , the ListBox "SETUPLOGLEVEL"
Property is not showing the value in C++ Custom action when I am calling 
MsiGetProperty(hInstall, L"SETUPLOGLEVEL", Pid, &PidLength). The pid is
showing 0 value after execution of this function also, I checked by
debugging the custom action. Here's my code CustomizeDlg.wxs ::

    <?xml version="1.0" encoding="UTF-8"?>
    <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi";>
      <Fragment>
        <UI Id ="CustomizeDlg">
    
          
          <Dialog Id="UserRegistrationDlg" Width="370" Height="270"
Title="[ProductName] Setup" NoMinimize="yes">
            <Control Id="MyListBox"
            Type="ListBox"  X="52" Y="48"
            Width="100" Height="45"
            Property="SETUPLOGLEVEL" Sorted="yes">
              
              <ListBox Property="SETUPLOGLEVEL">
    
                <ListItem Text="Debug"  Value="1" />
    
                <ListItem Text="info" Value="2" />
    
                <ListItem Text="warn" Value="3" />
    
              </ListBox>
              <Property Id="SETUPLOGLEVEL" Value="1"/>
             
            </Control>
              <Control Id="CDKeyLabel" Type="Text" X="45" Y="147" Width="50"
Height="10" TabSkip="no">
              <Text>CD &amp;Key:</Text>
            </Control>
            <Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="159"
Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" />
            <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56"
Height="17" Text="&amp;Back">
              <Publish Event="NewDialog"
Value="LicenseAgreementDlg">1</Publish>
            </Control>
            <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56"
Height="17" Default="yes" Text="&amp;Next">
              <Publish Event="ValidateProductID" Value="0">1</Publish>
              <Publish Event="SpawnWaitDialog"
Value="WaitForCostingDlg">CostingComplete = 1</Publish>
              <Publish Event="NewDialog"
Value="SetupTypeDlg">ProductID</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>
            <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370"
Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
            <Control Id="Description" Type="Text" X="25" Y="23" Width="280"
Height="15" Transparent="yes" NoPrefix="yes">
              <Text>Please mention the log level</Text>
            </Control>
            <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370"
Height="0" />
            <Control Id="Title" Type="Text" X="15" Y="6" Width="200"
Height="15" Transparent="yes" NoPrefix="yes">
              <Text>{\WixUI_Font_Title}Select Log Level</Text>
            </Control>
            <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370"
Height="0" />
          </Dialog>
        </UI>
      </Fragment>
    </Wix>

And This is my Custom action:

    #include "stdafx.h"
    
    #include <iostream>
    #include <fstream>
    #include <string>
    #include <algorithm>
    #include <stdio.h>
    #include <string.h>
    
    using namespace std;
    
    UINT __stdcall CustomAction1(MSIHANDLE hInstall)
    {
        HRESULT hr = S_OK;
        UINT er = ERROR_SUCCESS;
        string search_string;
        string replace_string;
        string inbuf;
    
       DWORD PidLength         = MAX_PATH;
    
        wchar_t Pid[MAX_PATH]   = {L"0"};
    
       MessageBox(NULL,L"debug", L"CustomactionDebug", MB_OK);
       
    
        hr = WcaInitialize(hInstall, "CustomAction1");
        ExitOnFailure(hr, "Failed to initialize");
        WcaLog(LOGMSG_STANDARD, "Initialized.");
    
        MsiGetProperty(hInstall, L"SETUPLOGLEVEL", Pid, &PidLength);
    
    
      
    
    LExit:
        er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE;
        return WcaFinalize(er);
    }
    
    
    // DllMain - Initialize and cleanup WiX custom action utils.
    extern "C" BOOL WINAPI DllMain(
        __in HINSTANCE hInst,
        __in ULONG ulReason,
        __in LPVOID
        )
    {
        switch(ulReason)
        {
        case DLL_PROCESS_ATTACH:
                WcaGlobalInitialize(hInst);
                break;
    
        case DLL_PROCESS_DETACH:
                WcaGlobalFinalize();
                break;
        }
    
        return TRUE;
    }



--
View this message in context: 
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/List-box-Property-value-not-coming-in-c-custom-action-wix-tp7593662.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to