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

Progress Bar


8 replies to this topic

processmate

processmate
  • Members
  • 15 posts

Posted 28 March 2002 - 17:06

Hello everyone (Mr.Stefan...how r u??)

Why is it that no one answers questions on progress bars?? Is it so difficult that there are no answers?? Or is is that its so very easy that no one bothers to respect questions on that??

I am using Installshield developer 7.02
I have a custom action that is deferred....runs for abt. 3-4 minutes. I have created Action Text. The progress bar ,after Copying file & registering product reaches 100 % , displayes my text and stays put at 100%. When my Custom Action....which is actually a VB Script.... gets executed i wd like to control the progress bar.. I cdnt make out anything from the help topics. The example there is in Installscript. I need some help with progress bars and VB Script...

Someone please help me


Thanks a million (in advance)

This forum has been so good to me... i have been around for only sometime...but it has been so good to me that i am working on Installshield without any help/books!!

Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 02 April 2002 - 01:45

Here is a short bit of VBScript that will advance the progress bar a bit:
Set oProgressRec = Session.Installer.CreateRecord(3)

oProgressRec.IntegerData(1) = 2
oProgressRec.IntegerData(2) = 50000
oProgressRec.IntegerData(3) = 0
Session.message msiMessageTypeProgress, oProgressRec

msiMessageTypeProgress has been defined earlier to &H0A000000

This advances the progress bar a total of 50000 "ticks".  The total number of ticks in your project depends on how large it is, and is calculated before running the deferred execution actions.

You'll need to create another custom action, with immediate execution, which adds an appropriate number of ticks to the total count.  I can't remember how to do this at the moment (just back from leave and my brain hasn't yet fired up).  If you need help with this, reply to this post, I'll look it up somewhere.
Leigh Ravenhall
Expert Information Services

processmate

processmate
  • Members
  • 15 posts

Posted 10 April 2002 - 16:06

Thank you very much for replying. Could u tell me more abt the CA with immediate execution that wd increment the ticks??

I have a deferred CA that runs a VB Script that installs a database. It takes about 3-4 minutes. As of now I just display a text that reads "Installing Database". But I dont control the progress bar. What I am looking for is a way by which i can control the progress bar..
Thanks again for ur help

Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 11 April 2002 - 00:53

Sorry, I think you may have misunderstood me.  You use an immediate execution custom action to reserve a number of ticks on the progress bar, which are then used later by a deferred execution custom action.  To reserve the ticks you use:
Code Sample

MSIHANDLE hEngine = NULL;
UINT iResult = MsiOpenPackage("c:\MyPackage.msi", &hEngine);
// Error handling code
PMSIHANDLE hRec = MsiCreateRecord(3);
MsiRecordSetInteger(hrec, 1, 3);        // ProgressAddition subclass
MsiRecordSetInteger(hrec, 2, 24000);    // Add 24000 ticks to the current progress total
iResult = MsiProcessMessage(hInstall, INSTALLMESSAGE_Progress, hRec);
// Error handling code

(Copied from the Msi help file)

The result of running this code in an immediate execution custom action, is to allocate some space on the progress bar for your deferred custom action to use.

When you run your deferred execution custom action, at regular intervals, you will need to advance the progress bar to use the space allocated.  For example, if you're importing data into a database, you may want to advance a number of ticks after each table has been imported.  To do that, you use the code I gave in my previous post.  (Sorry about the inconsistent language)

Another option for long custom actions, is to update the text above the progress bar.  For a database install, I think I had the messages, "Creating database", "Configuring database logins", "Importing data into table XXX", etc.  To update the progress bar text, I use the following:
Code Sample

Const msiMessageTypeActionStart = &H08000000

Set oRecord = Session.Installer.CreateRecord(3)

oRecord.StringData(1) = "CreateDatabase"
oRecord.StringData(2) = "Importing data into table " & strTableName
oRecord.StringData(3) = ""

Session.message msiMessageTypeActionStart, oRecord


Hope this helps.
Leigh Ravenhall
Expert Information Services

processmate

processmate
  • Members
  • 15 posts

Posted 11 April 2002 - 04:09

Hello Mr. Leigh

I will try working with the code that u have given me and get back to you if i run inot problems.... I was totally lost and didnt have a clue as to where i had to look... u have shown me a way... i will work on those lines...

Thanks mate
cheers

PS : Ur cricket team gave the proteas a good drubbing didnt they??!!! I am from India...cricket is our religion

processmate

processmate
  • Members
  • 15 posts

Posted 11 April 2002 - 16:31

Hello Mr. Leigh

I tried the code that u have given me.... Heres how it went...

The code that changes the text above the progress bar made such a huge difference to the whole setup. It looks feels reeeeeeeaaaly good now. Gosh, i cant thank you enof for the timely help. I feel so very good today, cos the code worked...it oh-so worked. Thanks mate.

The progress bar didnt budge!! It really was a damp squib.
I was really lost in code for the Immediate execute custom action. First it gave me errors.
PMSIHANDLE etc...gave me compilation errors.

This is what i have understood from ur reply. First i have to reserve ticks for the progress bar before the deferred CA runs.

I tried to do that using the code that u had given me. All those data types gave me errors

PMSIHANDLE,MSIHANDLE,UINT

MSIHANDLE hEngine = NULL;
UINT iResult = MsiOpenPackage("c:\MyPackage.msi", &hEngine);
// Error handling code
PMSIHANDLE hRec = MsiCreateRecord(3);
MsiRecordSetInteger(hrec, 1, 3);        // ProgressAddition subclass
MsiRecordSetInteger(hrec, 2, 24000);    // Add 24000 ticks to the current progress total
iResult = MsiProcessMessage(hInstall, INSTALLMESSAGE_Progress, hRec);
// Error handling code

I did away with the first two lines of code... declared hRec as POINTER

Did i really mess with the code bad??

Please help me out again... one last time....please..

Bye
Thanks once again for the progress text

Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 12 April 2002 - 00:25

Sorry, I copied that code directly from the MSI help file, it will be written for C++, not InstallScript.  I can't find the version I wrote in InstallScript, so I'm converting it at the moment.  Don't expect it to run straight off
Code Sample

export prototype reserveCost(HWND);
function reserveCost(hMSI)
NUMBER intResult;
POINTER hRec;
begin
hRec = MsiCreateRecord(3);
MsiRecordSetInteger(hRec, 1, 3);
MsiRecordSetInteger(hRec, 2, 24000);
intResult = MsiProcessMessage(hMSI, INSTALLMESSAGE_PROGRESS, hRec);
end;

Stick that into an InstallScript file and see how you go.  It looks about right, although I wouldn't be surprised if I've missed something.

VBScript should be something like:
Code Sample

Const msiMessageTypeProgress = &H0A000000

Sub ReserverCost()
Dim objRecord

Set objRecord = Session.Installer.CreateRecord(3)
objRecord.IntegerData(1) = 3
objRecord.IntegerData(2) = 24000

Session.Message msiMessageTypeProgress, objRecord

End Sub

Once again, this may require debugging, but it should be close.

One thing to note, particularly for large installs, is that you may have to increment a large number of ticks before you get any result.  If it doesn't appear to be working, change the numbers to something larger.  Instead of 24,000 ticks, try it with 500,000, more if your installation is really large.
Leigh Ravenhall
Expert Information Services

processmate

processmate
  • Members
  • 15 posts

Posted 12 April 2002 - 09:39

Hello Mr.Leigh

I am really sorry to pester u. Its a case of so-near-yet-so-far.

During installation, we get a message saying "Copying new files" in SetupProgress Dialog. My Deferred CA is called after that. Which means that the progress bar is already at 100%

So i reset the progress bar to 0 in the Deferred CA first and then tried to increment it. With slight modifications to ur code....by setting first field to 0 i accomplished that. Now the progress bar is at 0.

But the increment code doesnt work. The bar remains at 0.

Can the immediate CA that reserves ticks for progress placed anywhere in the sequence?? I placed it before InstallFinalize.

Do i have to subscribe the progress control to my Deferred CA? I tried that too. But wasnt of much help.

How does the Immediate Execute CA refer to the progress control?? When updating the text, the deferred custom action name is used to update the progress bar text. But in reserving ticks, how is the control identified??

Please help me Mr. Leigh. Now that i am kinda close...this thing is driving me nuts!!!

Thankyou
cheers

processmate

processmate
  • Members
  • 15 posts

Posted 17 April 2002 - 14:24

:p

Thanks Mr. Ravenhall & Mr.Agord.... the progress bar works...
With the text to go with the progres...its amazing...

Hurray to the site as well

Cheers all