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

SetupProgress Dialog


14 replies to this topic

Jann

Jann
  • Members
  • 35 posts

Posted 12 December 2001 - 18:36

I have some custom actions which run right at the end of the install.  As they are running the status says

Removing backup files.

How can I make changes so that it displays a status message which matches the CA.

ie. "Creating databases."

Thanks


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 12 December 2001 - 23:12

You should not be doing this right at the end of the install.  You should be doing this as a deferred action.  If your custom action is called InitialiseDatabase then create a line in the ActionText table.

Action: InitialiseDatabase
Description: Creating Database
Template: Creating Record [1] or whatever

If you will not be sending Action Data progress messages leave the Template blank.

If you really want to do a nice job you will want send INSTALLMESSAGE_PROGRESS to advance the progress bar.

You send Action Data, and Progress messages using MsiProcessMessage.


Jann

Jann
  • Members
  • 35 posts

Posted 13 December 2001 - 13:06

Thanks,  i found the actiontext table but i can't get it to work.

I need to have the CA set as immediate execution because I need to use properties.

Is this why it won't work?  is there any other way around it?

Not sure i understand the Template column either.

Thanks again


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 13 December 2001 - 17:09

I am sorry if I sound pedantic but If you want MSI to work with you, you must comply with msi design rules.  All changes to the  target system should be done with deferred custom actions.

Parameters can be passed to deferred actions.  Using the name of your CA eg. InitialiseDatabase create another CA of Type 51.

Action : SetupInitialiseDatabase
Type :  51
Source : InitialiseDatabase
Target : [Property1];[Property2];...;[PropertyN]

In your deferred action "InitialiseDatabase" you call
MsiGetProperty(hInstaller, "CustomActionData", Buffer, &BufferLength);
You then parse the Buffer into your parameters.

-----------------------------

When a custom action executes a typical installation dialog subscribes to two type of messages Action Text and Action Data.   When a custom action sends a ActionText message,  by default from the Action Text Table or explicitly using MsiProcessMessage.  It defines a heading that is recieved by controls subscribing to the ActionText and defines the template to be used by controls subscribing to ActionData.   Custom actions that  send Action Data messages just send the data.
---------------------------------------------------------
Example

PMSIHANDLE ActionTextRec = MsiCreateRecord(3);
PMSIHANDLE ActoionDataRec = MsiCreateRecord(2);

// Name of action
MsiRecordSetString(ActionStartRec, 0, "Convert");
// Description of action for display
MsiRecordSetString(ActionStartRec,1,"Converting Picture Format");
// Action Data Template
MsiRecordSetString(ActionStartRec,2,"Old Name [1] : New Name [2]")
MsiProcessMessage(hInstaller, INSTALLMESSAGE_ACTIONSTART, ActionStartRec);
....
....
lstrcpy(OldName, "pic.raw");
lstcpy(NewName, "pic.bmp");
MsiRecordSetString(ActionDataRec,0, OldName);
MsiRecordSetString(ActionDataRec,1, NewName);
MsiProcessMessage(hInstaller, INSTALLMESSAGE_ACTIONDATA, ActionDataRec);
ConverFormat(OldName. NewName);
...
...




Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 13 December 2001 - 23:29

As someone who originally wrote a huge number of immediate execution custom actions, placed right after InstallFinalize, I'm familiar with Jann's situation.

After giving in to Ian's "pedantic" advice, I have to admit that the installations are a lot more reliable and user friendly than they use to be.  Jann, you may find it a hassle at first, setting up property assignment actions, parsing the passed in data, etc, but it does make things easier in the long run.

If nothing else, it'll stop Ian repeating himself.  :)


Jann

Jann
  • Members
  • 35 posts

Posted 14 December 2001 - 18:08

thanks for your help but i do still have a problem with this.

If i change them to deferred CA's:
I'm not trying to set a property but i am actually trying to get one.

I am also using vbscript.  any ideas?

Thanks


Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 16 December 2001 - 23:24

The set propert that Ian suggested was so that you could retrieve your properties in a deferred execution custom action.  When retrieving from a deferred execution custom action, you need put all the data that you would like to retrieve in a property whose name is the same as the custom action.  

Because you can only retrieve one property, you need to place all the data into a single string, seperating the individual pieces by a character that you can use later to break the string back into it's individual components.  That is why Ian has [Prop1];[Prop2];...  The semicolons can then be used later to seperate the individual components.  The type 51 custom action to set the property must run as immediate.

In your deferred execution custom action, you would then have the following (in VBScript):

strProperties = Session.Property("CustomActionData")
Array = Split(strProperties, ";")

strProp1 = Array(0)
strProp2 = Array(1)
etc,etc.

You should then be able to run the custom action as normal.


Dhiren

Dhiren
  • Members
  • 4 posts

Posted 07 January 2002 - 22:55

I have tried the same in Developr 7 (Basic MSI Style)
But didnt work.
My Custom Action comes after  InstallFinalize CA.
I have added my CustomAction name in ActionText table and I have added in Subscription of Progress control also. But it doenot comes on top of Progressbar.

Please help
Dhiren


Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 07 January 2002 - 23:18

Entries in the ActionText table will not be processed for Custom Actions scheduled for immediate execution.  You will need your custom action to run as deferred, placed between InstallInitialise and InstallFinalise.  See the earlier posts in the thread for how to do this.

Dhiren

Dhiren
  • Members
  • 4 posts

Posted 08 January 2002 - 22:04

Hi there
I have one Custom dialog on which I have added one TEXT control. Default value will be empty string.
When I click on NEXT, I am trying to connect to local SQL Server, at this time I want to display message "Connecting to server..." into that TEXT control. But its not happening...Help...

Dhiren

Dhiren
  • Members
  • 4 posts

Posted 11 January 2002 - 00:20

Hi,
  I am able to change text (progress message on top of progressbar) while executing my custom action, but
not able to add ticks to the ProgressBar.
Please help !!
Dhiren


Ian Blake

Ian Blake
  • Members
  • 483 posts

Posted 11 January 2002 - 10:20

You need two custom actions.  An immediate action to perform setup functions, and a deferred action to do the installation operations.

See the example in the documentation
Windows Installer
--Custom Actions
----Using Custom Actions
------Adding Custom Actions to the ProgressBar

It is not made expicitly clear in the documentation but you need to define two CAs in the installer one immerdiate and one deferred even though it is only a single function in the example.




agord

agord
  • Members
  • 10 posts

Posted 07 February 2002 - 22:35

I tested slightly modifyed MSDN example, but I failed to detect where on progress bar panel 'incrementing tick [1] of [2]' visualized. What is wrong?


Const iTickIncrement = 10000
Const iTotalTicks = 10000000

Dim Path, WshShell, Installer, Record, RecordProgress

Set Installer = CreateObject("WindowsInstaller.Installer")
Set WshShell = CreateObject( "WScript.Shell" )
Set Record = Installer.CreateRecord(4)
Set RecordProgress = Installer.CreateRecord(4)

Record.StringData(1) = "PreProgress.vbs"
Record.StringData(2) = "Incrementing the Progress Bar..."
Record.StringData(3) = "incrementing tick [1] of [2]"
Message &H08000000, Record

Record.IntegerData(1) = 1
Record.IntegerData(2) = 1
Record.IntegerData(3) = 0
Message &H0A000000, Record

RecordProgress.IntegerData(1) = 2
RecordProgress.IntegerData(2) = iTickIncrement
RecordProgress.IntegerData(3) = 0

Record.IntegerData(2) = iTotalTicks
For i = 0 To iTotalTicks Step iTickIncrement
   Message &H09000000, Record
   Message &H0A000000, RecordProgress
   If (i Mod (iTotalTicks / 5)) = 0 Then
       WshShell.Run "NOTEPAD.EXE", 10, True
   End If
Next


Ari Glaizel

Ari Glaizel
  • Members
  • 1 posts

Posted 19 February 2002 - 16:48

Quote
Quote: from Leigh Ravenhall on 10:29 pm on Dec. 13, 2001
As someone who originally wrote a huge number of immediate execution custom actions, placed right after InstallFinalize, I'm familiar with Jann's situation.

After giving in to Ian's "pedantic" advice, I have to admit that the installations are a lot more reliable and user friendly than they use to be.  Jann, you may find it a hassle at first, setting up property assignment actions, parsing the passed in data, etc, but it does make things easier in the long run.

If nothing else, it'll stop Ian repeating himself.  :)


I still find this very awkward. I'm always a proponent of adhering to the architecture, but I don't understand what I gain by doing this.. Here is an approximate sample of how I update the status message during my custom action execution.. All of my custom actions are immediate BTW.

UINT SetProgressBarText(MSIHANDLE hInstall, LPCTSTR lpszCATitle, LPCTSTR lpszProgressText)
{
PMSIHANDLE hRecord;

hRecord = MsiCreateRecord(3);

MsiRecordSetString(hRecord, 1, lpszCATitle);
MsiRecordSetString(hRecord, 2, lpszProgressText);
MsiRecordSetString(hRecord, 3, _T(""));
MsiProcessMessage(hInstall, INSTALLMESSAGE_ACTIONSTART, hRecord);

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

return ERROR_SUCCESS;
}

So at the beginning of my custom action called 'CreateDatabase' I would do something like:

SetProgressBarText(hInstall, _T("CreateDatabase"), _T("Creating user database"));

(Edited by Ari Glaizel at 3:51 pm on Feb. 19, 2002)


Kiril

Kiril
  • Members
  • 39 posts

Posted 20 February 2002 - 16:52

Create immediate CA and insert  after InstallFinalize Action.

function SetStatusText(hMSI)  
NUMBER  hRec;
begin    
hRec = MsiCreateRecord(3);
MsiRecordSetString(hRec,1,"Progress Custom Action");
MsiRecordSetString(hRec,2,"Creating Database");
MsiRecordSetString(hRec,3,"incrementing tick [1] of [2]");
   MsiProcessMessage(hMSI, INSTALLMESSAGE_ACTIONSTART, hRec);
end;