Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to display install progress from CA


8 replies to this topic

bluesky9898

bluesky9898
  • Members
  • 11 posts

Posted 28 January 2004 - 19:59

During the installing, a Custom Action was called. When this CA was called and processed, I wanted to dislay some information on the setupProgress Dialog.
For that, I defined a new entry in ActionText control. However, the description
didn't show up.

Anything else I need to do?

Thanks,

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 29 January 2004 - 08:26

This only works for deferred custom actions.

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 29 January 2004 - 10:14

If your CA is type 1 (DLL call), you can use MsiProcessMessage to control the text at runtime.
AFAIK, this method works for all kinds of CAs (normal, deferred, rollback) anywhere in the Execute sequence.

LindaT

LindaT
  • Members
  • 6 posts

Posted 29 January 2004 - 19:35

Hi,

I've tried the MsiProcessMessage on my basic msi project. The text is updated (immediate action, ui sequence), but the progress bar is not updated.

I launch some exe files during the ui sequence and really need to update the progress bar to inform the user that something's happening, but I don't know how to get this to work? I've read a thread on InstallShield Community (see below), which doesn't give me much hope to succeed in installscript/ui sequence, but I figure there has to be a solution to this??

Linda

__________________________
http://community.ins...threadid=123406

Actually, you'll need two actions: an immediate one to add the total number of ticks to the progress bar, and a deferred one to add individual ticks to increment the progress bar.

For a VBScript version of the general ideas, please see this thread: http://community.ins...threadid=105165.
__________________________



luke_s

luke_s
  • Full Members
  • 532 posts

Posted 30 January 2004 - 05:17

Try getting a hold of the Windows Installer SDK, this contains an example of how to update the progress bar.

LindaT

LindaT
  • Members
  • 6 posts

Posted 31 January 2004 - 12:44

I've looked in the help for Windows Installer. The code I'm using is taken from "Adding Custom Actions to the progress bar", but I've modified it so it's InstallScript now.
The first part works (updating the text), but unfortunately nothing happens to the progress bar until my exe file has finished running (actually probably even later in the seqence).
Maybe I have to split it into several custom actions, one for updating the text, one to run the exe file and then a third one to update the ticks on the progress bar?

I'm also a little confused as to how the ActionText, SetProgress dialog and the progress bar control event work together. What do I have to "link together" (and how) to get this to work? It would be nice to be able to use a subscription in some way.

Regards,
Linda

LindaT

LindaT
  • Members
  • 6 posts

Posted 09 February 2004 - 17:54

Problem solved! smile.gif

Now I can both display progress text and add ticks to the progress bar. All this is done as immediate execution CA's in the ui sequence.

Add total ticks to the progress bar and reset the progress bar - this CA is sequenced before SetupProgress.
Display progress text.
Run the CA that should affect the progress.
Add a CA that increments the progress bar.

The progress bar should subscribe to the CA incrementing the progress.
Include ISMsiQuery.h.

/Linda

function CA_Progress(hInstall) // increment the progress bar
NUMBER iResult;
HWND hRec, hProgressRec;
NUMBER nvBufferSize;
begin
hRec = MsiCreateRecord(3);
hProgressRec = MsiCreateRecord(3);
// Tell the installer to use explicit progress messages.
MsiRecordSetInteger(hRec, 1, 1);
MsiRecordSetInteger(hRec, 2, 1);
MsiRecordSetInteger(hRec, 3, 0);
iResult = MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hRec);

//Specify that an update of the progress bar's position in
//this case means to move it forward by one increment.
MsiRecordSetInteger(hProgressRec, 1, 2);
MsiRecordSetInteger(hProgressRec, 2, szSizeTickIncrement);
MsiRecordSetInteger(hProgressRec, 3, 0);

// The following tells the installer to send a message to update
// the progress bar.

iResult = MsiProcessMessage(hInstall, INSTALLMESSAGE_PROGRESS, hProgressRec);

MsiCloseHandle(hRec);
MsiCloseHandle(hProgressRec);

end;



vigneshraja123

vigneshraja123
  • Full Members
  • 2 posts

Posted 24 February 2010 - 13:00

Hi

I am new to Installshield. I am using Installshield 2010.

My problem is also similiar, i added a dialog in the UI sequence for the extracting of files, since it took a long time i am trying to add a progress bar. So i followed this particular thread.

sequenced the resetProgress CA before setupprogress dialog
sequenced the addProgress CA after the setup progress dialog
sequenced the IncrementProgress after addProgress CA

added message in the action text which is subscibed in the progressbar in setup progress dialog

all CA's are scheulded as immediate action in UI sequence
all CA's are subscribed to progressbar in the setup progress dialog

I used the code from msdn.microsoft.com/en-us/library/aa367525(VS.85).aspx and splitted it into three CA's. I cross checked the code available in the link with the code available in this thread.

But still progress is not visible in progressbar, but i can see the action text message.

could anybody help me on this?



Regards
Vignesh

Edited by vigneshraja123, 24 February 2010 - 13:11.


vigneshraja123

vigneshraja123
  • Full Members
  • 2 posts

Posted 26 February 2010 - 12:23

Here is the comple code of setup.rul

////////////////////////////////////////////////////////////////////////////////
//
// IIIIIII SSSSSS
// II SS InstallShield ®
// II SSSSSS © 1996-2002, InstallShield Software Corporation
// II SS All rights reserved.
// IIIIIII SSSSSS
//
//
// This template script provides the code necessary to build an entry-point
// function to be called in an InstallScript custom action.
//
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
////////////////////////////////////////////////////////////////////////////////

// Include Ifx.h for built-in InstallScript function prototypes, for Windows
// Installer API function prototypes and constants, and to declare code for
// the OnBegin and OnEnd events.
#include "ifx.h"
#include "ISMsiQuery.h"

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

NUMBER iTickIncrement;
NUMBER iNumberItems;
NUMBER iTotalTicks;


// To Do: Declare global variables, define constants, and prototype user-
// defined and DLL functions here.


// To Do: Create a custom action for this entry-point function:
// 1. Right-click on "Custom Actions" in the Sequences/Actions view.
// 2. Select "Custom Action Wizard" from the context menu.
// 3. Proceed through the wizard and give the custom action a unique name.
// 4. Select "Run InstallScript code" for the custom action type, and in
// the next panel select "MyFunction" (or the new name of the entry-
// point function) for the source.
// 5. Click Next, accepting the default selections until the wizard
// creates the custom action.
//
// Once you have made a custom action, you must execute it in your setup by
// inserting it into a sequence or making it the result of a dialog's
// control event.

///////////////////////////////////////////////////////////////////////////////
//
// Function: MyFunction
//
// Purpose: This function will be called by the script engine when
// Windows™ Installer executes your custom action (see the "To
// Do," above).
//
///////////////////////////////////////////////////////////////////////////////
function ResetProgressBar(hMSI)
HWND hRec, hProgressRec;
NUMBER nvBufferSize;
NUMBER iResult;

begin

iTickIncrement = 10000;
iNumberItems = 10;
iTotalTicks = iTickIncrement * iNumberItems;

hRec = MsiCreateRecord(4);
hProgressRec = MsiCreateRecord(4);
MsiRecordSetInteger(hProgressRec, 1, 0);
MsiRecordSetInteger(hProgressRec, 2, iTotalTicks);
MsiRecordSetInteger(hProgressRec, 3, 0);
MsiRecordSetInteger(hProgressRec, 4, 0);
iResult = MsiProcessMessage(hMSI, INSTALLMESSAGE_PROGRESS, hProgressRec);

end;

///////////////////////////////////////////////////////////////////////////////
//
// Function: MyFunction
//
// Purpose: This function will be called by the script engine when
// Windows™ Installer executes your custom action (see the "To
// Do," above).
//
///////////////////////////////////////////////////////////////////////////////
function AddProgressBar(hMSI)
HWND hActionRec, hProgressRec;
NUMBER nvBufferSize;
NUMBER iResult;
NUMBER iCount;

begin


hProgressRec = MsiCreateRecord(2);
MsiRecordSetInteger(hProgressRec, 1, 3);
MsiRecordSetInteger(hProgressRec, 2, iTotalTicks);
iResult = MsiProcessMessage(hMSI, INSTALLMESSAGE_PROGRESS, hProgressRec);

end;

///////////////////////////////////////////////////////////////////////////////
//
// Function: MyFunction
//
// Purpose: This function will be called by the script engine when
// Windows™ Installer executes your custom action (see the "To
// Do," above).
//
///////////////////////////////////////////////////////////////////////////////
function IncrementProgressBar(hMSI)
NUMBER iResult;
HWND hRec, hProgressRec;
NUMBER nvBufferSize;

begin

hRec = MsiCreateRecord(3);
hProgressRec = MsiCreateRecord(3);

// Tell the installer to use explicit progress messages.
MsiRecordSetInteger(hRec, 1, 1);
MsiRecordSetInteger(hRec, 2, 1);
MsiRecordSetInteger(hRec, 3, 0);
iResult = MsiProcessMessage(hMSI, INSTALLMESSAGE_PROGRESS, hRec);

//Specify that an update of the progress bar's position in
//this case means to move it forward by one increment.
MsiRecordSetInteger(hProgressRec, 1, 2);
MsiRecordSetInteger(hProgressRec, 2, iTickIncrement);
MsiRecordSetInteger(hProgressRec, 3, 0);

// The following tells the installer to send a message to update
// the progress bar.

iResult = MsiProcessMessage(hMSI, INSTALLMESSAGE_PROGRESS, hProgressRec);

MsiCloseHandle(hRec);
MsiCloseHandle(hProgressRec);

end;


I created 3 custom action

NmResetProgressBar
NmIncrementProgressBar
NmAddprogressBar

I sequenced as

NmResetProgressBar
SetupProgress Dialog
NmIncrementProgressBar
NmAddProgressBar
ISSetupFilesExtract.


The reason i am using a progress bar it is taking some time to extract the files which is added in the support files.

Could you help me on this?


Vignesh

Attached Files