您可以通过向安装程序发出INSTALLMESSAGE_PROGRESS
消息来手动控制进度栏的状态。详细信息可以在这里找到:
http://msdn.microsoft.com/en-us/library/aa370354.aspx
特别是,你需要一个自定义操作来管理状态栏(这是什么会负责制定相应的调用MsiProcessMessage
我建议你也。用它酿出子安装下面是一些伪代码来说明我心里有:
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);
}
主要不利的方面是,进度条会在一定程度上断断续续地进步,如果你真的想要的。为了获得幻想并使其更加流畅,您可以启动一个独立的“侦听器”线程来等待获取来自子安装程序的更新,以便对进度条进行更细粒度的增量。喜欢的东西:
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
}
}
}
显然每个子安装程序必须能够发出信号已经取得进展的主要安装程序,所以这将有可能需要跨您的产品更广泛的变化。是否值得这个努力取决于你。
您是否有任何关于在WIX中使用WPF UI的信息?一直在寻找如何使用嵌入式用户界面选项,但没有找到任何示例。 – 2010-03-24 14:09:39