diff --git a/modules/rostests/apitests/shell32/FindExecutable.cpp b/modules/rostests/apitests/shell32/FindExecutable.cpp index 07a673af8bd..132c9589e65 100644 --- a/modules/rostests/apitests/shell32/FindExecutable.cpp +++ b/modules/rostests/apitests/shell32/FindExecutable.cpp @@ -8,6 +8,7 @@ #include "shelltest.h" #include #include +#include "shell32_apitest_sub.h" static char s_sub_program[MAX_PATH]; @@ -268,4 +269,6 @@ START_TEST(FindExecutable) DeleteFileA(s_sys_bat_file); DeleteFileA(s_win_txt_file); DeleteFileA(s_sys_txt_file); + + DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE); } diff --git a/modules/rostests/apitests/shell32/SHChangeNotify.cpp b/modules/rostests/apitests/shell32/SHChangeNotify.cpp index e1edb4a5376..7a95fc470f6 100644 --- a/modules/rostests/apitests/shell32/SHChangeNotify.cpp +++ b/modules/rostests/apitests/shell32/SHChangeNotify.cpp @@ -8,7 +8,7 @@ // NOTE: This test program closes the Explorer windows before tests. #include "shelltest.h" -#include "SHChangeNotify.h" +#include "shell32_apitest_sub.h" #include #include #include @@ -32,31 +32,6 @@ static WCHAR s_szSubProgram[MAX_PATH]; static HANDLE s_hThread = NULL; static HANDLE s_hEvent = NULL; -static HWND DoWaitForWindow(LPCWSTR clsname, LPCWSTR text, BOOL bClosing, BOOL bForce) -{ - HWND hwnd = NULL; - for (INT i = 0; i < 50; ++i) - { - hwnd = FindWindowW(clsname, text); - if (bClosing) - { - if (!hwnd) - break; - - if (bForce) - PostMessage(hwnd, WM_CLOSE, 0, 0); - } - else - { - if (hwnd) - break; - } - - Sleep(1); - } - return hwnd; -} - static BOOL DoCreateEmptyFile(LPCWSTR pszFileName) { FILE *fp = _wfopen(pszFileName, L"wb"); @@ -964,5 +939,5 @@ START_TEST(SHChangeNotify) #endif DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE); - Sleep(500); + Sleep(100); } diff --git a/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp b/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp index ce53cd45968..699def5e114 100644 --- a/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp +++ b/modules/rostests/apitests/shell32/ShellExecCmdLine.cpp @@ -8,6 +8,7 @@ #include #include #include +#include "shell32_apitest_sub.h" #define NDEBUG #include @@ -738,4 +739,7 @@ START_TEST(ShellExecCmdLine) ok(DeleteFileA("Test File 1.txt"), "failed to delete the test file\n"); ok(DeleteFileA("Test File 2.bat"), "failed to delete the test file\n"); free(s_wi0.phwnd); + + DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE); + Sleep(100); } diff --git a/modules/rostests/apitests/shell32/ShellExecuteEx.cpp b/modules/rostests/apitests/shell32/ShellExecuteEx.cpp index 3e33c075d10..70f33ca4021 100644 --- a/modules/rostests/apitests/shell32/ShellExecuteEx.cpp +++ b/modules/rostests/apitests/shell32/ShellExecuteEx.cpp @@ -9,6 +9,7 @@ #include "shelltest.h" #include #include +#include "shell32_apitest_sub.h" #define ok_ShellExecuteEx (winetest_set_location(__FILE__, __LINE__), 0) ? (void)0 : TestShellExecuteEx @@ -465,4 +466,7 @@ START_TEST(ShellExecuteEx) DoAppPathTest(); DoTestEntries(); test_properties(); + + DoWaitForWindow(CLASSNAME, CLASSNAME, TRUE, TRUE); + Sleep(100); } diff --git a/modules/rostests/apitests/shell32/shell32_apitest_sub.cpp b/modules/rostests/apitests/shell32/shell32_apitest_sub.cpp index 1b90c7ae39a..5a56b08aefb 100644 --- a/modules/rostests/apitests/shell32/shell32_apitest_sub.cpp +++ b/modules/rostests/apitests/shell32/shell32_apitest_sub.cpp @@ -6,7 +6,7 @@ */ #include "shelltest.h" -#include "SHChangeNotify.h" +#include "shell32_apitest_sub.h" static HWND s_hwnd = NULL; static UINT s_uRegID = 0; diff --git a/modules/rostests/apitests/shell32/SHChangeNotify.h b/modules/rostests/apitests/shell32/shell32_apitest_sub.h similarity index 74% rename from modules/rostests/apitests/shell32/SHChangeNotify.h rename to modules/rostests/apitests/shell32/shell32_apitest_sub.h index e20b6b7a74c..bff2e174683 100644 --- a/modules/rostests/apitests/shell32/SHChangeNotify.h +++ b/modules/rostests/apitests/shell32/shell32_apitest_sub.h @@ -59,7 +59,7 @@ inline LPITEMIDLIST DoGetPidl(DIRTYPE iDir) return ret; } -inline LPWSTR DoGetDir(DIRTYPE iDir) +static inline LPWSTR DoGetDir(DIRTYPE iDir) { static size_t s_index = 0; static WCHAR s_pathes[3][MAX_PATH]; @@ -71,3 +71,28 @@ inline LPWSTR DoGetDir(DIRTYPE iDir) s_index = (s_index + 1) % _countof(s_pathes); return psz; } + +static inline HWND DoWaitForWindow(LPCWSTR clsname, LPCWSTR text, BOOL bClosing, BOOL bForce) +{ + HWND hwnd = NULL; + for (INT i = 0; i < 50; ++i) + { + hwnd = FindWindowW(clsname, text); + if (bClosing) + { + if (!hwnd) + break; + + if (bForce) + PostMessage(hwnd, WM_CLOSE, 0, 0); + } + else + { + if (hwnd) + break; + } + + Sleep(1); + } + return hwnd; +}