ReactOS 0.4.15-dev-8119-g4fb2fdb
closewnd.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS API tests
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Close windows after tests
5 * COPYRIGHT: Copyright 2024 Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
6 */
7
8#include "shelltest.h"
9#include "closewnd.h"
10
12{
13 free(pList->m_phWnds);
14 pList->m_phWnds = NULL;
15 pList->m_chWnds = 0;
16}
17
19{
21 return TRUE;
22
24 SIZE_T cb = (pList->m_chWnds + 1) * sizeof(HWND);
25 HWND *phWnds = (HWND *)realloc(pList->m_phWnds, cb);
26 if (!phWnds)
27 return FALSE;
28 phWnds[pList->m_chWnds++] = hwnd;
29 pList->m_phWnds = phWnds;
30 return TRUE;
31}
32
34{
35 pList->m_phWnds = NULL;
36 pList->m_chWnds = 0;
38}
39
41{
42 for (SIZE_T i2 = 0; i2 < List2->m_chWnds; ++i2)
43 {
44 HWND hWnd = List2->m_phWnds[i2];
46 continue;
47
48 BOOL bFoundInList1 = FALSE;
49 for (SIZE_T i1 = 0; i1 < List1->m_chWnds; ++i1)
50 {
51 if (hWnd == List1->m_phWnds[i1])
52 {
53 bFoundInList1 = TRUE;
54 break;
55 }
56 }
57
58 if (!bFoundInList1)
59 return hWnd;
60 }
61 return NULL;
62}
63
64#define TRIALS_COUNT 8
65
67{
68 INT cDiff = List2->m_chWnds - List1->m_chWnds;
69 for (INT j = 0; j < cDiff; ++j)
70 {
71 HWND hWnd = FindNewWindow(List1, List2);
72 if (!hWnd)
73 break;
74
75 for (INT i = 0; i < TRIALS_COUNT; ++i)
76 {
77 if (!IsWindow(hWnd))
78 break;
79
81
82 // Alt+F4
83 keybd_event(VK_MENU, 0x38, 0, 0);
84 keybd_event(VK_F4, 0x3E, 0, 0);
87 Sleep(100);
88 }
89 }
90}
HWND hWnd
Definition: settings.c:17
static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
Definition: closewnd.cpp:18
#define TRIALS_COUNT
Definition: closewnd.cpp:64
void CloseNewWindows(PWINDOW_LIST List1, PWINDOW_LIST List2)
Definition: closewnd.cpp:66
void GetWindowList(PWINDOW_LIST pList)
Definition: closewnd.cpp:33
HWND FindNewWindow(PWINDOW_LIST List1, PWINDOW_LIST List2)
Definition: closewnd.cpp:40
void FreeWindowList(PWINDOW_LIST pList)
Definition: closewnd.cpp:11
struct WINDOW_LIST * PWINDOW_LIST
LPARAM lParam
Definition: combotst.c:139
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CALLBACK
Definition: compat.h:35
unsigned int BOOL
Definition: ntddk_ex.h:94
FxChildList * pList
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
SIZE_T m_chWnds
Definition: closewnd.h:12
HWND * m_phWnds
Definition: closewnd.h:13
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
VOID WINAPI SwitchToThisWindow(HWND hwnd, BOOL fAltTab)
Definition: window.c:82
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI IsWindow(_In_opt_ HWND)
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
#define VK_F4
Definition: winuser.h:2258
BOOL WINAPI IsWindowEnabled(_In_ HWND)
BOOL WINAPI IsWindowVisible(_In_ HWND)
#define KEYEVENTF_KEYUP
Definition: winuser.h:1102
#define VK_MENU
Definition: winuser.h:2204