[wix-users] Burn: mba support for INSTALLMESSAGE_ACTIONDATA contextual info for progress bar. [P]

Steven Ogilvie Steven.Ogilvie at titus.com
Fri Nov 20 07:33:27 PST 2015


Classification: Public
Hey Phil,

I ended up modifying the Burn code, in WIX_ToolSet_v3.10\src\ext\BalExtension\wixstdba\WixStandardBootstrapperApplication.cpp

At the method: OnExecuteMsiMessage
if (BOOTSTRAPPER_DISPLAY_FULL == m_command.display && (INSTALLMESSAGE_WARNING == mt || INSTALLMESSAGE_USER == mt))
        {
            int nResult = ::MessageBoxW(m_hWnd, wzMessage, m_pTheme->sczCaption, uiFlags);
            return nResult;
        }

        if (INSTALLMESSAGE_ACTIONSTART == mt)
        {
            // Need to trim the action data text
            CString tempString = wzMessage;
            size_t strLength = wcslen(tempString);
            // Find the first '.' and removes text to the left of it i.e.: 'Action <time>: CustomAction name. progress text' to just 'progress text'
            size_t strPosition = tempString.Find('.', 0);
            // Check to see if there is another '.'
            // Find the second '.' and removes text to the left of it i.e.: 'Action <time>: MergeModueGUID. progress text' to just 'progress text'
            if (strPosition != -1)
            {
                size_t nextPosition = tempString.Find('.', strPosition + 1);
                // Make sure it found something before using its position
                if (nextPosition != -1)
                {
                    strPosition = nextPosition;
                }
            }

            // Need to add + 2 for position since it will still show the '. '
            CString trimString = tempString.Right(strLength - (strPosition + 2));

            // Use the CString trimString instead of wzMessage, leave wzMessage alone
            ThemeSetTextControl(m_pTheme, WIXSTDBA_CONTROL_EXECUTE_PROGRESS_ACTIONDATA_TEXT, trimString);

Then in my WiX product.wxs for each custom action I have:

<UI>
      <ProgressText Action="CA_UPGRADE_GET_ADMINCONNECTSTR">CA: Getting Administration connection strings</ProgressText>
    </UI>

Works like a charm now I see the progress text (action text) in the progress page of Burn

Steve


-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Phill Hogland
Sent: November-20-15 10:05 AM
To: WiX Uses (wix-users at lists.wixtoolset.org) <wix-users at lists.wixtoolset.org>
Subject: [wix-users] Burn: mba support for INSTALLMESSAGE_ACTIONDATA contextual info for progress bar.

I have tried several approaches to updating the progress text from my Wca-based C++ deferred custom action.  I have read many posts and all of the C++ wix related posts that I have found agree with my observation that the 'templated' portion of the ActionData message is never displayed.  The Action name and the Action 'description' are displayed.  I have not used the Wix ComPlusExtension, but I notice that it implements using ActionData.  So I tried to follow the pattern that I observed there.

1)      I added ProgressText/@Template to the ProgresText element that I already had for the CA, in the wixlib of my CompilerExptension.

2)      I added functions similar to CpiActionStartMessage and CpiActionDataMessage to my CA project.

3)      In the immediate CA I pass info from a custom table to CustomActionData, for access in the deferred CA.

4)      In the deferred CA I call the ActionStartMessage() with the action name, a description, and a template "Enabling [1]".  (initially and tried many other approaches).

5)      Then in the loop I call the ActionDataMessage string with a name of a feature being enabled.

The Action name and the 'description' are displayed but the 'template' (with or without the payload string) is never displayed (in my Burn driven mba).  One thing about this approach that I wonder about is that I think that the PMSIHANDLE defined in the ActiuonStartMessage function has gone out of scope by the time the ActionDataMessage function has been called.

So I commented out that approach and implemented the code found at this link directly in the CA (without any utility functions) https://msdn.microsoft.com/en-us/library/aa367525(v=vs.85).aspx

And in this case I even tried to implement this code with the template "Incrementing tick [1] of [2]" with the calls to INSTALLMESSAGE_PROGRSS (which the ComPlusExtension does not have, and I probably don't really need to just modify the text).  However I wanted to see if the example code would work in my project, and I observed the same results where the 'template' portion of the string is never displayed.

Then I compared the code at this link, with the code in wiutil.cpp (of dutil project) in the function HandleInstallProgress().
https://msdn.microsoft.com/en-us/library/aa368786(v=vs.85).aspx

I am not sure that I understand the wix code, but I don't see where there is code similar to the example code for handling case INSTALLMESSAGE_ACTIONDATA:
        // only act if progress total has been initialized
        if (0 == g_iProgressTotal)
            return IDOK;
        SetDlgItemText(/*handle to your dialog*/,/*identifier of your actiontext control*/, szMessage);
        if(g_bEnableActionData)
        {
            SendMessage(/*handle to your progress control*/,PBM_STEPIT,0,0);
        }
        return IDOK;

I see in the wix code, and I suspect that in my implementation fEnableActionData is being set to FALSE, but I did not see how to get it to TRUE.  In my second test of the MSDN code the INSTALLMESAGE_PROGRESS Field[2] is set to 1.

    case 1: // action info.
        if (3 > cFields)
        {
            Trace2(REPORT_STANDARD, "INSTALLMESSAGE_PROGRESS - Invalid field count %d, '%ls'", cFields, wzMessage);
            ExitFunction();
        }
        //Trace3(REPORT_STANDARD, "INSTALLMESSAGE_PROGRESS - ACTION INFO - %d, %d, %d", iFields[1], iFields[2], iFields[3]);

        if (0 == iFields[2])
        {
            pContext->rgMsiProgress[pContext->dwCurrentProgressIndex].fEnableActionData = FALSE;
        }
        else
        {
            pContext->rgMsiProgress[pContext->dwCurrentProgressIndex].fEnableActionData = TRUE;
            pContext->rgMsiProgress[pContext->dwCurrentProgressIndex].dwStep = iFields[1];
        }
        break;

I finally got an implementation hack that seems to work by abending the effort to use INSTALLMESSAGE_ACTIONDATA in the CA loop, and moving the INSTALLMESSAGE_ACTIONSTART to the CA loop and formatting the 'description' field with the changing text that I want to display.  But this hack smells like the wrong approach, so I am interested in advice on how to get this working in a 'correct' way.

I am also curious if anyone using the WixComPlusExtension has noticed whether the ActionData portion to the Progress text is actually being displayed (with names of assemblies, or users, etc)?

If so is there something that I should have implemented in my mba to support this behavior?
Thanks for any advice!

Phill

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
 



 
This message has been marked as Public by Steven Ogilvie on November-20-15 10:33:26 AM.

The above classification labels were added to the message by TITUS Message Classification. 
For more information visit www.titus.com.


More information about the wix-users mailing list