2020-05-19 00:29:42 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-12-27 00:45:44 +00:00
|
|
|
#include <shlwapi.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <strsafe.h>
|
|
|
|
|
2024-04-24 00:10:29 +00:00
|
|
|
#define MAIN_CLASSNAME L"SHChangeNotify main window"
|
|
|
|
#define SUB_CLASSNAME L"SHChangeNotify sub-window"
|
2021-12-27 00:45:44 +00:00
|
|
|
|
|
|
|
#define WM_SHELL_NOTIFY (WM_USER + 100)
|
2022-02-13 08:45:08 +00:00
|
|
|
|
2024-04-24 09:25:15 +00:00
|
|
|
#define NUM_STAGE 10
|
|
|
|
|
2022-02-13 08:45:08 +00:00
|
|
|
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;
|
|
|
|
}
|