You can manually control the progress bar status by sending INSTALLMESSAGE_PROGRESS messages to the installer. Details can be found here:
http://msdn.microsoft.com/en-us/library/aa370354.aspx
In particular, you will need a custom action to control the status bar (this will be responsible for making the corresponding calls to MsiProcessMessage . I recommend that you also use it to create tweaks. This is some pseudo code to illustrate what I mean:
LONG LaunchSubinstallersCA(MSIHANDLE current_installer) { // Initialize the progress bar range and position MsiProcessMessage(current_installer, reset_message); // see MSDN for details for each (subinstaller in list_of_installers) { launch subinstaller; // see MSDN for details // Update the progress bar to reflect most recent changes MsiProcessMessage(current_installer, increment_message); // see MSDN for details } return (result); }
The main downside is that the progress bar will be somewhat volatile. If you really wanted to get the fantasy and make it smoother, you can start a separate thread of the โlistenerโ, which will wait for updates from the sub-installer to make fine-grained increments for the progress bar. Something like:
LONG LaunchSubinstallersCA(MSIHANDLE current_installer) { // Initialize the progress bar range and position MsiProcessMessage(current_installer, reset_message); // see MSDN for details launch_listener_thread(); // launches listener_thread_proc (see below) for each (subinstaller in list_of_installers) { launch subinstaller; // see MSDN for details } tell_listener_thread_to_stop(); optionally_wait_for_listener_thread_to_die(); return (result); } void listener_thread_proc() { // Loop until told to stop while (!time_for_me_to_stop) { // Listen for update from sub-installer timed_wait_for_update(); // probably required IPC, perhaps a named event? // Only update the progress bar if an update message was actually received if (!timeout) { // Update the progress bar to reflect most recent changes MsiProcessMessage(current_installer, increment_message); // see MSDN for details } } }
Obviously, each installer would have to signal to the main installer that progress has been made, so this would potentially require more extensive changes to your product. Whether itโs worth the effort is up to you.
Brian
source share