cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
anom217
Level 8

Updating Progress Bar help

I have a Basic MSI project and I'm trying to have the progress bar reflect the progress of each of my custom actions (I have many). Right now I've added each of my custom actions to Subscriptions for the SetupProgress dialog, but during installation after the InstallFiles action the progress bar is 100% and never goes down for the rest of the installation.

I've looked at several threads:
http://community.flexerasoftware.com/showthread.php?t=161418&page=2&highlight=progress+bar+custom+action
http://community.flexerasoftware.com/showthread.php?t=164957&page=2
http://community.flexerasoftware.com/showthread.php?t=105165

But I think I am missing some fundamental concept. In all these threads people have created two CA's, a deferred action to increment ticks and an immediate action to add the total number of ticks to the progress bar.

What I don't understand is where do these get called? Would I call the deferred function itself inside my custom action that I want to update the progress bar? Do I need a separate deferred and immediate action for each of my custom actions I want to update progress for?

I'm missing some point on this and could really use an explanation. Thanks.
Labels (1)
0 Kudos
(12) Replies
anom217
Level 8

can anyone help me out here?
0 Kudos
anom217
Level 8

well here's the code I have so far

function AddTotalTicks(hInstall)  //Immediate Execution 
OBJECT rec;
NUMBER iResult;
HWND hRec;
begin
set rec = MsiCreateRecord(2);
MsiRecordSetInteger(rec, 1, 3);
MsiRecordSetInteger(rec, 2, 5000000);
MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, rec);
set rec = NOTHING;

// reset the progress bar
hRec = MsiCreateRecord(3);
MsiRecordSetInteger(hRec, 1, 0);
MsiRecordSetInteger(hRec, 2, 100);
MsiRecordSetInteger(hRec, 3, 0);
iResult = MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRec);
end;

I've seen threads saying to have this immediate CA in the execution sequence and in the UI sequence, so I'm not sure which it's supposed to be.

function AddProgressInfo(hInstall)  	//Deferred Execution 
HWND hProgRec, hRec;
NUMBER i;
begin
hRec = MsiCreateRecord(3);

MsiRecordSetInteger(hRec, 1, 1);
MsiRecordSetInteger(hRec, 2, 1);
MsiRecordSetInteger(hRec, 3, 0);
MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRec);

hProgRec = MsiCreateRecord(3);
MsiRecordSetInteger(hProgRec, 1, 2);
MsiRecordSetInteger(hProgRec, 2, 500000);
MsiRecordSetInteger(hProgRec, 3, 0);

MsiRecordSetInteger(hRec, 2, 5000000);

for i=0 to 5000000 step 500000
MsiRecordSetInteger(hRec, 1, i);
MsiProcessMessage(hInstall, INSTALLMESSAGE_ACTIONDATA, hRec);
MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hProgRec);
//Delay(1);
endfor;

MsiCloseHandle(hRec);
MsiCloseHandle(hProgRec);
end;


I call AddProgressInfo very first thing inside the deferred CA I want to add progress ticks for. I also have AddProgressInfo subscribed to the SetupProgress dialog with Progress as the attribute.

I'm still having a problem with the progress bar going to near 100% after InstallFiles and never resetting. AddTotalTicks should be resetting it, but it doesn't seem to be.

Does anyone actually know how to successfully use the progress bar?
0 Kudos
RobertDickau
Flexera Alumni

The immediate action that adds the total extra ticks should go in the Execute sequence; and the deferred action adds ticks as it makes system changes. (There's also an example in the Windows Installer help library that might be of use, and our advanced MSI training course talks about this subject a bit.)

I'm not sure I follow the comments about resetting; are you trying to get the progress bar back to zero, or add your action's ticks to the overall flow? Does the example [thread=105165]here[/thread], for example, match what you're looking for?
0 Kudos
Reureu
Level 10

Well, ideally, you should follow Rob's advice, and implement these 2 custom actions.

But depending on what InstallShield features you are using, you might realize that some of the IS custom actions (like ISXmlInstall, if you are using XML file changes, see this other thread: http://community.flexerasoftware.com/showthread.php?t=191440) actually reset the progress bar in the middle of the sequence.

I reckon it is another bug in InstallShield. So, forewarned is forearmed!
0 Kudos
anom217
Level 8

Thanks for the responses. Okay. So I only have to call the add total ticks immediate action once in the Execute sequence? And I need to call the deferred action whenever I need to update the progress bar (i.e. everytime I have one of my own custom actions execute). I assume that means calling the deferred function within my other functions.
0 Kudos
RobertDickau
Flexera Alumni

Correct; if you haven't, please see the help topic "Adding Custom Actions to the ProgressBar" for an explanation.
0 Kudos
anom217
Level 8

After messing around a bit I can actually see it doing something. I'm also trying to reset the progress bar after the InstallFiles action, since it moves it to 100%. I have my immediate action that adds the total number of ticks scheduled right after InstallFiles. I have my deferred action that increments the progress bar scheduled directly after that.

I have the code to Reset the progress bar, and it works if I include it in the deferred action at the beginning, before it tries to increment the progress bar. The reset works, but then the bar doesn't update for the rest of the installation. I tried sticking the Reset code into the immediate action before setting the total number of ticks, but that doesn't seem to have any effect. The progress bar doesn't get reset after executing InstallFiles.
0 Kudos
anom217
Level 8

I still can't figure out how to get this working correctly. If I have my custom action that resets the progress bar and sets the total number of ticks execute as an immediate action, the progress bar doesn't get reset. If I have it set as a deferred action, the progress bar does reset, but then it never increases again. I even see the status messages being displayed from my deferred message that is supposed to increment the bar, but nothing happens.

I'm really stuck trying to figure this out.
0 Kudos
RobertDickau
Flexera Alumni

To simplify things a bit (as in [post=459224]this earlier follow-up[/post]), perhaps skip the reset and see if you can incorporate the tick count in the total count? If the progress bar goes to 100%, it generally means the add-ticks action is in the wrong place or the tick count being added is too small...
0 Kudos
anom217
Level 8

Okay, I believe I finally got it working. Thanks!

Still seems a bit crude to me, since I'm manually adding ticks to the progress bar, but it works well enough.
0 Kudos
RobertDickau
Flexera Alumni

Agreed that it takes some hand-tuning, which makes sense since a custom action is outside the scope of what MSI can keep track of... Thanks for posting the update!
0 Kudos
Reureu
Level 10

Rob,

as we are discussing the progress bar, am I right in thinking that some of the IS custom actions (like ISXmlInstall) actually reset the progress bar?

I managed to get the progress bar working fine, until the InstallExecuteSequence reaches ISXmlInstall.
So, it looks like another bug to me. Any chance you can confirm that please?

Regards
0 Kudos