cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Marcus_Chuang
Level 4

Updating the ProgressBar

Hi all:
I've searched all posts about how to update the progress bar in this forum. However, all are not worked fine for me. The Progress bar is always 100% and that is not what I want.

My problem is: I hope it can move 10% per second. After 10 seconds, the progress bar is 100%.

I reference one thread posted by RobertDickau: http://community.installshield.com/showthread.php?t=105165

My procedures is listed below:
1. Create an empty InstallScript MSI project

2. Copy RobertDickau's VBScript Code and modify it to InstallScript Language. (My modified InstallScript code is attached below.)

3. Use Custom Action Wizard to create two CAs to link InstallScript functions. One is called AddProgressInfo (deferred exection, executed before InstallFiles CA), the other is called AddTotalTicks (immediate execution, executed before AddProgressInfo).

4. Finally, build this release.

I believe some necessary steps iare missed by me. Ex: Should I modify MSI table in DirectEditor? Like ControlEvent or EventMapping Table or something. If yes, how to do?

Any help is appreciated. Thanks in advance.


[CODE]// Included header files ----------------------------------------------------
#include "ifx.h"

// Note: In order to have your InstallScript function executed as a custom
// action by the Windows Installer, it must be prototyped as an
// entry-point function.

// The keyword export identifies MyFunction() as an entry-point function.
// The argument it accepts must be a handle to the Installer database.

/* export prototype MyFunction(HWND); */
export prototype AddProgressInfo(HWND);
export prototype AddTotalTicks(HWND);
function AddProgressInfo(hInstall) //Deferred Execution
OBJECT rec;
OBJECT progrec;
NUMBER i;
begin
set rec = MsiCreateRecord(3);
MsiRecordSetString(rec, 1, "callAddProgressInfo");
MsiRecordSetString(rec, 2, "Incrementing the progress bar...");
MsiRecordSetString(rec, 3, "Incrementing tick [1] of [2]");
MsiProcessMessage(hInstall, INSTALLMESSAGE_ACTIONSTART, rec);

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

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

MsiRecordSetInteger(rec, 2, 5000000);

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

end;

function AddTotalTicks(hInstall) //Immediate Execution
OBJECT rec;
begin
set rec = MsiCreateRecord(3);
MsiRecordSetInteger(rec, 1, 2);
MsiRecordSetInteger(rec, 2, 5000000);
MsiRecordSetInteger(rec, 3, 0);
MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, rec);
end;
[/CODE]
Labels (1)
0 Kudos
(1) Reply
chiheng
Level 2

I came across your post and this link on MSDN when I was searching for the related topics.

This is what you need to do for your AddTotalTicks function:

function AddTotalTicks(hInstall) //Immediate Execution
OBJECT rec;
begin
set rec = MsiCreateRecord(2);
MsiRecordSetInteger(rec, 1, 3);
MsiRecordSetInteger(rec, 2, 5000000);
MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, rec);
end;


It works for me.
0 Kudos