[5/5] comctl32: Implement the TaskDialog function

Joachim Priesner joachim.priesner at web.de
Thu Feb 19 06:23:12 CST 2015


---
 dlls/comctl32/comctl32.spec      |  1 +
 dlls/comctl32/taskdialog.c       | 20 ++++++++++++++++++++
 dlls/comctl32/tests/taskdialog.c | 24 +++++++++++++++++++++---
 include/commctrl.h               |  2 ++
 4 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/dlls/comctl32/comctl32.spec b/dlls/comctl32/comctl32.spec
index 0bd8b13..e6fda68 100644
--- a/dlls/comctl32/comctl32.spec
+++ b/dlls/comctl32/comctl32.spec
@@ -61,6 +61,7 @@
 340 stdcall -ordinal DPA_CreateEx(long long)
 341 stdcall -noname SendNotify(long long long ptr)
 342 stdcall -noname SendNotifyEx(long long long ptr long)
+344 stdcall -ordinal TaskDialog(long long ptr ptr ptr long ptr ptr)
 345 stdcall -ordinal TaskDialogIndirect(ptr ptr ptr ptr)
 350 stdcall -noname -private StrChrA(str str)
 351 stdcall -noname -private StrRChrA(str str long)
diff --git a/dlls/comctl32/taskdialog.c b/dlls/comctl32/taskdialog.c
index 8e0aaa4..8242881 100644
--- a/dlls/comctl32/taskdialog.c
+++ b/dlls/comctl32/taskdialog.c
@@ -449,6 +449,26 @@ static INT_PTR CALLBACK TASKDIALOG_DlgProc(HWND hwnd, UINT message,
 }
 
 /***********************************************************************
+ * TaskDialog [COMCTL32.@]
+ */
+HRESULT WINAPI TaskDialog(HWND hWndParent, HINSTANCE hInstance, PCWSTR pszWindowTitle,
+                          PCWSTR pszMainInstruction, PCWSTR pszContent,
+                          TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons, PCWSTR pszIcon,
+                          int *pnButton)
+{
+    TASKDIALOGCONFIG config = {0};
+    config.cbSize = sizeof(TASKDIALOGCONFIG);
+    config.hwndParent = hWndParent;
+    config.hInstance = hInstance;
+    config.pszWindowTitle = pszWindowTitle;
+    config.pszMainInstruction = pszMainInstruction;
+    config.pszContent = pszContent;
+    config.dwCommonButtons = dwCommonButtons;
+    config.pszMainIcon = pszIcon;
+    return TaskDialogIndirect(&config, pnButton, NULL, NULL);
+}
+
+/***********************************************************************
  * TaskDialogIndirect [COMCTL32.@]
  */
 HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton,
diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c
index af1563a..dcb97dc 100644
--- a/dlls/comctl32/tests/taskdialog.c
+++ b/dlls/comctl32/tests/taskdialog.c
@@ -25,6 +25,7 @@
 
 HMODULE hComctl32;
 HRESULT (WINAPI *pTaskDialogIndirect)(const TASKDIALOGCONFIG*, int*, int*, BOOL*);
+HRESULT (WINAPI *pTaskDialog)(HWND, HINSTANCE, PCWSTR, PCWSTR, PCWSTR, TASKDIALOG_COMMON_BUTTON_FLAGS, PCWSTR, int);
 
 static void test_TaskDialogIndirect_ProcAddr(void)
 {
@@ -61,6 +62,12 @@ static void test_TaskDialogIndirect_InvalidParameters(void)
             "got result %#x, expected E_INVALIDARG\n", result);
 }
 
+static void test_TaskDialog_ProcAddr(void)
+{
+    void *ptr = GetProcAddress(hComctl32, (const CHAR*)344);
+    ok(ptr == pTaskDialog, "got wrong pointer for ordinal 344, %p expected %p\n", ptr, pTaskDialog);
+}
+
 START_TEST(taskdialog)
 {
     ULONG_PTR ctx_cookie;
@@ -80,11 +87,22 @@ START_TEST(taskdialog)
     if (!pTaskDialogIndirect)
     {
         win_skip("TaskDialogIndirect() is missing. Skipping the tests\n");
-        return;
+    }
+    else
+    {
+        test_TaskDialogIndirect_ProcAddr();
+        test_TaskDialogIndirect_InvalidParameters();
     }
 
-    test_TaskDialogIndirect_ProcAddr();
-    test_TaskDialogIndirect_InvalidParameters();
+    pTaskDialog = (void*)GetProcAddress(hComctl32, "TaskDialog");
+    if (!pTaskDialog)
+    {
+        win_skip("TaskDialog() is missing. Skipping the tests\n");
+    }
+    else
+    {
+        test_TaskDialog_ProcAddr();
+    }
 
     unload_v6_module(ctx_cookie, hCtx);
 }
diff --git a/include/commctrl.h b/include/commctrl.h
index af60ad3..8eadf0d 100644
--- a/include/commctrl.h
+++ b/include/commctrl.h
@@ -5168,6 +5168,8 @@ typedef struct _TASKDIALOGCONFIG
     UINT        cxWidth;
 } TASKDIALOGCONFIG;
 
+HRESULT WINAPI TaskDialog(HWND, HINSTANCE, PCWSTR, PCWSTR, PCWSTR,
+                          TASKDIALOG_COMMON_BUTTON_FLAGS, PCWSTR, int *);
 HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *, int *, int *, BOOL *);
 
 #include <poppack.h>
-- 
1.8.4.5




More information about the wine-patches mailing list