Hello again,
for anybody who is interested, here is the vbscript translation:
----------------------------------
const msiMessageTypeActionStart = &H08000000
const msiMessageTypeProgress = &H0A000000
const msiMessageTypeActionData = &H09000000
const iTickIncrement = 10000
const iNumberItems = 10
Dim iTotalTicks
dim oActionRec, oProgressRec, oActionData
Sub TestProgressBar
iTotalTicks = iTickIncrement * iNumberItems
if session.mode(16) then
set oProgressRec = session.Installer.createRecord(3)
oProgressRec.IntegerData(1) = 0
oProgressRec.IntegerData(2) = iTotalTicks
oProgressRec.IntegerData(3) = 0
session.message msiMessageTypeProgress, oProgressRec
' Installer is executing the installation script. Set up a
' record specifying appropriate templates and text for
' messages that will inform the user about what the custom
' action is doing. Tell the installer to use this template and
' text in progress messages.
set oActionRec = session.Installer.createRecord(3)
oActionRec.StringData(1) = "TestProgressBar" 'Action name
oActionRec.StringData(2) = "Incrementing the Progress Bar..." 'Description
oActionRec.StringData(3) = "Incrementing tick [1] of [2]" 'template for action data messages
session.message msiMessageTypeActionStart, oActionRec
' Tell the installer to use explicit progress messages.
oProgressRec.IntegerData(1) = 1 'reset
oProgressRec.IntegerData(2) = 1 'total ticks + 1
oProgressRec.IntegerData(3) = 0 'right to left
session.message msiMessageTypeProgress,oProgressRec
' Tell the installer to increment for each ActionData message
oProgressRec.IntegerData(1) = 2 'action info
oProgressRec.IntegerData(2) = iTickIncrement 'increment 1 tick per
oProgressRec.IntegerData(3) = 0 'increment 1 bar per tick
' session.message msiMessageTypeProgress,oProgressRec
' The following loop sets up the record needed by the action
' messages and tells the installer to send a message to update
' the progress bar.
' set oActionRec = session.Installer.createRecord(3)
oActionRec.IntegerData(2) = iTotalTicks
dim x
for x = 0 to iTotalTicks step iTickIncrement
MsgBox cstr(x)
oActionRec.IntegerData(1) = x
session.message msiMessageTypeActionData, oActionRec
session.message msiMessageTypeProgress, oProgressRec
next
MsgBox "Leaving TestProgressBar"
else
' Installer is generating the installation script of the custom action.
' Tell the installer to increase the value of the final total
' length of the progress bar by the total number of ticks in
' the custom action.
set oProgressRec = session.Installer.createRecord(2)
oProgressRec.IntegerData(1) = 3
oProgressRec.IntegerData(2) = iTotalTicks
session.message msiMessageTypeProgress, oProgressRec
end if
End Sub
-----------------------
other useful information can be found at:
http://msdn2.microsoft.com/en-us/library/aa367525.aspx
http://msdn2.microsoft.com/en-us/library/aa371614.aspx
http://msdn2.microsoft.com/en-us/library/aa370354.aspx
Note this example will reset and then increment the progress bar for the loop. I could not figure out:
A) how to extend the progress bar with additional ticks
i.e.:
set oProgressRec = session.Installer.createRecord(2)
oProgressRec.IntegerData(1) = 3
oProgressRec.IntegerData(2) = iTotalTicks
session.message msiMessageTypeProgress, oProgressRec
does not seem to make a difference
B) assign this control to a different progress bar object
Regards,
Sam
FOLLOW US
Get the latest news in Application Packaging