[PATCH 1/5] comctl32/taskdialog: Add support for TDM_ENABLE_BUTTON.

Zhiyi Zhang zzhang at codeweavers.com
Thu Jun 14 03:00:57 CDT 2018


Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/comctl32/taskdialog.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index 7a09b8a6d2..b6baffb3ea 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -163,6 +163,26 @@ static DLGTEMPLATE *create_taskdialog_template(const TASKDIALOGCONFIG *taskconfi
     return template;
 }
 
+static HWND taskdialog_find_button(HWND *buttons, INT count, INT id)
+{
+    INT button_id;
+    INT i;
+
+    for (i = 0; i < count; i++)
+    {
+        button_id = GetWindowLongW(buttons[i], GWLP_ID);
+        if (button_id == id) return buttons[i];
+    }
+
+    return NULL;
+}
+
+static void taskdialog_enable_button(const struct taskdialog_info *dialog_info, INT id, BOOL enable)
+{
+    HWND hwnd = taskdialog_find_button(dialog_info->buttons, dialog_info->button_count, id);
+    if (hwnd) EnableWindow(hwnd, enable);
+}
+
 static HRESULT taskdialog_notify(struct taskdialog_info *dialog_info, UINT notification, WPARAM wparam, LPARAM lparam)
 {
     const TASKDIALOGCONFIG *taskconfig = dialog_info->taskconfig;
@@ -525,6 +545,9 @@ static INT_PTR CALLBACK taskdialog_proc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
         case TDM_CLICK_BUTTON:
             taskdialog_on_button_click(dialog_info, LOWORD(wParam));
             break;
+        case TDM_ENABLE_BUTTON:
+            taskdialog_enable_button(dialog_info, wParam, lParam);
+            break;
         case WM_INITDIALOG:
             dialog_info = (struct taskdialog_info *)lParam;
 
-- 
2.17.1





More information about the wine-devel mailing list