Removing backup files.
How can I make changes so that it displays a status message which matches the CA.
ie. "Creating databases."
Thanks
Posted 12 December 2001 - 18:36
Removing backup files.
How can I make changes so that it displays a status message which matches the CA.
ie. "Creating databases."
Thanks
Posted 12 December 2001 - 23:12
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.
Posted 13 December 2001 - 13:06
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
Posted 13 December 2001 - 17:09
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);
...
...
Posted 13 December 2001 - 23:29
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. :)
Posted 14 December 2001 - 18:08
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
Posted 16 December 2001 - 23:24
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.
Posted 07 January 2002 - 22:55
Please help
Dhiren
Posted 07 January 2002 - 23:18
Posted 08 January 2002 - 22:04
Posted 11 January 2002 - 00:20
Posted 11 January 2002 - 10:20
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.
Posted 07 February 2002 - 22:35
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
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)
Posted 20 February 2002 - 16:52
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;