From 629d9c56999ba6a4f56dc93fc919e2143e8bb62f Mon Sep 17 00:00:00 2001 From: Zhiyi Zhang Date: Thu, 14 Jun 2018 16:01:43 +0800 Subject: [PATCH] comctl32/taskdialog: Add support for loading standard icons. Signed-off-by: Zhiyi Zhang Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/comctl32/taskdialog.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c index 14c6ccb6e4e..59a915977c8 100644 --- a/dlls/comctl32/taskdialog.c +++ b/dlls/comctl32/taskdialog.c @@ -247,6 +247,20 @@ static void taskdialog_get_label_size(struct taskdialog_info *dialog_info, HWND ReleaseDC(hwnd, hdc); } +static ULONG_PTR taskdialog_get_standard_icon(LPCWSTR icon) +{ + if (icon == TD_WARNING_ICON) + return IDI_WARNING; + else if (icon == TD_ERROR_ICON) + return IDI_ERROR; + else if (icon == TD_INFORMATION_ICON) + return IDI_INFORMATION; + else if (icon == TD_SHIELD_ICON) + return IDI_SHIELD; + else + return (ULONG_PTR)icon; +} + static void taskdialog_set_icon(struct taskdialog_info *dialog_info, INT element, HICON icon) { DWORD flags = dialog_info->taskconfig->dwFlags; @@ -259,6 +273,9 @@ static void taskdialog_set_icon(struct taskdialog_info *dialog_info, INT element else { hicon = LoadImageW(dialog_info->taskconfig->hInstance, (LPCWSTR)icon, IMAGE_ICON, 0, 0, LR_SHARED | LR_DEFAULTSIZE); + if (!hicon) + hicon = LoadImageW(NULL, (LPCWSTR)taskdialog_get_standard_icon((LPCWSTR)icon), IMAGE_ICON, 0, 0, + LR_SHARED | LR_DEFAULTSIZE); } if (!hicon) return;