ReactOS 0.4.15-dev-8119-g4fb2fdb
closewnd.cpp File Reference
#include "shelltest.h"
#include "closewnd.h"
Include dependency graph for closewnd.cpp:

Go to the source code of this file.

Macros

#define TRIALS_COUNT   8
 

Functions

void FreeWindowList (PWINDOW_LIST pList)
 
static BOOL CALLBACK EnumWindowsProc (HWND hwnd, LPARAM lParam)
 
void GetWindowList (PWINDOW_LIST pList)
 
HWND FindNewWindow (PWINDOW_LIST List1, PWINDOW_LIST List2)
 
void CloseNewWindows (PWINDOW_LIST List1, PWINDOW_LIST List2)
 

Macro Definition Documentation

◆ TRIALS_COUNT

#define TRIALS_COUNT   8

Definition at line 64 of file closewnd.cpp.

Function Documentation

◆ CloseNewWindows()

void CloseNewWindows ( PWINDOW_LIST  List1,
PWINDOW_LIST  List2 
)

Definition at line 66 of file closewnd.cpp.

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
#define TRIALS_COUNT
Definition: closewnd.cpp:64
HWND FindNewWindow(PWINDOW_LIST List1, PWINDOW_LIST List2)
Definition: closewnd.cpp:40
#define TRUE
Definition: types.h:120
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
SIZE_T m_chWnds
Definition: closewnd.h:12
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
int32_t INT
Definition: typedefs.h:58
VOID WINAPI SwitchToThisWindow(HWND hwnd, BOOL fAltTab)
Definition: window.c:82
BOOL WINAPI IsWindow(_In_opt_ HWND)
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
#define VK_F4
Definition: winuser.h:2258
#define KEYEVENTF_KEYUP
Definition: winuser.h:1102
#define VK_MENU
Definition: winuser.h:2204

Referenced by TEST_End().

◆ EnumWindowsProc()

static BOOL CALLBACK EnumWindowsProc ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 18 of file closewnd.cpp.

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}
struct WINDOW_LIST * PWINDOW_LIST
LPARAM lParam
Definition: combotst.c:139
#define realloc
Definition: debug_ros.c:6
#define FALSE
Definition: types.h:117
FxChildList * pList
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
ULONG_PTR SIZE_T
Definition: typedefs.h:80
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
BOOL WINAPI IsWindowVisible(_In_ HWND)

Referenced by GetWindowList().

◆ FindNewWindow()

HWND FindNewWindow ( PWINDOW_LIST  List1,
PWINDOW_LIST  List2 
)

Definition at line 40 of file closewnd.cpp.

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}
#define NULL
Definition: types.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND * m_phWnds
Definition: closewnd.h:13
BOOL WINAPI IsWindowEnabled(_In_ HWND)

Referenced by CloseNewWindows().

◆ FreeWindowList()

void FreeWindowList ( PWINDOW_LIST  pList)

Definition at line 11 of file closewnd.cpp.

12{
13 free(pList->m_phWnds);
14 pList->m_phWnds = NULL;
15 pList->m_chWnds = 0;
16}
#define free
Definition: debug_ros.c:5

Referenced by TEST_End().

◆ GetWindowList()

void GetWindowList ( PWINDOW_LIST  pList)

Definition at line 33 of file closewnd.cpp.

34{
35 pList->m_phWnds = NULL;
36 pList->m_chWnds = 0;
38}
static BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
Definition: closewnd.cpp:18
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)

Referenced by TEST_End(), and TEST_Start().