ControlEvent 概觀
ControlEvents 事件類似於 Microsoft Windows 在 Win32 型應用程式中的訊息。 不過,使用者介面 (UI) 安裝程式和控件會發佈 ControlEvents,而不是建立回呼函式來接收 Windows 訊息,並使用 sendMessage 函式傳送 Windows 訊息。 您可以指定其他控件和安裝程式來訂閱特定 ControlEvents,然後變更訂閱控件的屬性。 若要將工作控件新增至對話方塊,UI 的作者會在 ControlEvent 資料表中指定 ControlEvents 的發行集,並將控件訂閱至 EventMapping 數據表中的 ControlEvents。
安裝程式會將下列事件發佈至訂閱 EventMapping 資料表中所列的控制項,。 ProgressBar 控件 或 看板控件 通常會訂閱 SetProgress,其餘控件則由 Text 控件訂閱。
下列事件會在項目選取範圍移至 SelectionTree 控件 或 DirectoryList 控件時,由控件發佈。 訂閱控件必須位於相同的對話框,並列在 EventMapping 數據表中。
SelectionDescription ControlEvent
使用者可以自行決定是否透過與對話方塊上的 PushButton 控制項 或 CheckBox 控制項 的互動來發佈下列的 ControlEvents。 複選框控件只能發佈 AddLocal、AddSource、Remove、DoAction 和 SetProperty 事件。 使用隨附於 Windows Server 2003 和更新版本的 Windows Installer 版本,SelectionTree 控件 可以發佈 DoAction、ControlEvent 和 SetProperty ControlEvents。 UI 的作者應該在 ControlEvent 資料表中列出 ControlEvent。 安裝程式的 UI 處理程式是這些事件的訂閱者。
ValidateProductID ControlEvent
PushButton 控制項 可以將下列事件發佈至位於相同對話框中的訂閱 SelectionTree 控制項 或 DirectoryList 控制項。 PushButton 控件應該列在 ControlEvent 數據表中,訂閱控件應該列在 EventMapping 數據表中。
控件事件通常需要在 完整的UI 層級執行UI。 大部分的 ControlEvents 都不支援 簡化的 UI 或 基礎 UI,因為這些層級僅顯示無模式對話方塊。 ActionText、AddSource、SetProgress、TimeRemaining 和 ScriptInProgress 事件是例外狀況,而且會在縮減或基本 UI 中運作。 如需 UI 層級的詳細資訊,請參閱 使用者介面層級。
您可以透過從 PushButton 控件 或 複選框控件發佈的 ControlEvent,來執行 自定義動作 。 將記錄新增至 ControlEvent 數據表,其中包含對話框的名稱,以及發行 ControlEvent 的控件。 此控制項應該發佈 DoAction ControlEvent 通知安裝程式執行自定義動作。 在 Windows XP 或舊版系統上,您無法從 SelectionTree 控制件發佈 ControlEvent來執行自定義動作。
如需特定 ControlEvents 的詳細資訊,請參閱 使用者介面參考中的標準 ControlEvents 列表。