mirror of
https://github.com/reactos/reactos.git
synced 2024-09-15 15:19:37 +00:00
25e2f5f277
Make the testcase more stable and faster. Reduce code. JIRA issue: CORE-13950 - Use WM_COPYDATA message to communicate with shell32_apitest_sub.exe. - Use concept of "stage" and "step". - Do multiple checks in one step. - Flush notification by using (SHCNF_FLUSH | SHCNF_FLUSHNOWAIT) flags.
37 lines
737 B
C
37 lines
737 B
C
#pragma once
|
|
|
|
#include <shlwapi.h>
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <strsafe.h>
|
|
|
|
#define MAIN_CLASSNAME L"SHChangeNotify main window"
|
|
#define SUB_CLASSNAME L"SHChangeNotify sub-window"
|
|
|
|
#define WM_SHELL_NOTIFY (WM_USER + 100)
|
|
|
|
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;
|
|
}
|