ReactOS  0.4.15-dev-3439-g2693a26
SetFocus.c File Reference
#include "precomp.h"
#include <dlgs.h>
#include <process.h>
Include dependency graph for SetFocus.c:

Go to the source code of this file.

Macros

#define INTERVAL   80
 

Functions

static HWND GetMainThreadFocus (void)
 
static unsigned __stdcall thread_proc_0 (void *arg)
 
static unsigned __stdcall thread_proc_1 (void *arg)
 
static unsigned __stdcall thread_proc_2 (void *arg)
 
static INT_PTR CALLBACK DialogProc_0 (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK DialogProc_1 (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
 START_TEST (SetFocus)
 

Variables

static DWORD s_dwMainThreadID
 

Macro Definition Documentation

◆ INTERVAL

#define INTERVAL   80

Definition at line 12 of file SetFocus.c.

Function Documentation

◆ DialogProc_0()

static INT_PTR CALLBACK DialogProc_0 ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 115 of file SetFocus.c.

116 {
117  HANDLE hThread;
118  switch (uMsg)
119  {
120  case WM_INITDIALOG:
121  ok_int(GetFocus() == NULL, TRUE);
125 
128 
131 
134 
137 
141  return TRUE;
142 
143  case WM_COMMAND:
144  switch (LOWORD(wParam))
145  {
146  case psh2:
150  break;
151 
152  case psh3:
154  EndDialog(hwnd, IDCLOSE);
155  break;
156  }
157  break;
158  }
159  return 0;
160 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:598
static unsigned __stdcall thread_proc_0(void *arg)
Definition: SetFocus.c:23
#define WM_NEXTDLGCTL
Definition: winuser.h:1630
UINT uMsg
Definition: menu.cpp:213
#define TRUE
Definition: types.h:120
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI SetFocus(_In_opt_ HWND)
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
#define psh2
Definition: dlgs.h:113
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define psh3
Definition: dlgs.h:114
#define ok_int(expression, result)
Definition: atltest.h:134
#define psh1
Definition: dlgs.h:112
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
PVOID HANDLE
Definition: typedefs.h:73
#define WM_COMMAND
Definition: winuser.h:1727
#define NULL
Definition: types.h:112
HANDLE hThread
Definition: wizard.c:28
HWND WINAPI GetFocus(void)
Definition: window.c:1909
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1726
#define LOWORD(l)
Definition: pedump.c:82

Referenced by START_TEST().

◆ DialogProc_1()

static INT_PTR CALLBACK DialogProc_1 ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 163 of file SetFocus.c.

164 {
165  HANDLE hThread;
166  switch (uMsg)
167  {
168  case WM_INITDIALOG:
171  return FALSE;
172 
173  case WM_COMMAND:
174  switch (LOWORD(wParam))
175  {
176  case psh2:
179  ok_int(GetFocus() == NULL, TRUE);
180 
183  break;
184 
185  case psh3:
186  ok_int(GetFocus() == NULL, TRUE);
188 
189  ok_int(GetFocus() == NULL, TRUE);
192 
195  break;
196 
197  case psh4:
200 
203 
205  EndDialog(hwnd, IDCLOSE);
206  break;
207  }
208  break;
209  }
210  return 0;
211 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:598
UINT uMsg
Definition: menu.cpp:213
#define TRUE
Definition: types.h:120
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SW_HIDE
Definition: winuser.h:762
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
#define psh2
Definition: dlgs.h:113
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define psh3
Definition: dlgs.h:114
#define ok_int(expression, result)
Definition: atltest.h:134
#define SW_SHOW
Definition: winuser.h:769
#define psh4
Definition: dlgs.h:115
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
PVOID HANDLE
Definition: typedefs.h:73
#define WM_COMMAND
Definition: winuser.h:1727
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define NULL
Definition: types.h:112
HANDLE hThread
Definition: wizard.c:28
HWND WINAPI GetFocus(void)
Definition: window.c:1909
static unsigned __stdcall thread_proc_1(void *arg)
Definition: SetFocus.c:70
static unsigned __stdcall thread_proc_2(void *arg)
Definition: SetFocus.c:91
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1726
#define LOWORD(l)
Definition: pedump.c:82

Referenced by START_TEST().

◆ GetMainThreadFocus()

static HWND GetMainThreadFocus ( void  )
static

Definition at line 16 of file SetFocus.c.

17 {
18  GUITHREADINFO gui = { sizeof(gui) };
20  return gui.hwndFocus;
21 }
static DWORD s_dwMainThreadID
Definition: SetFocus.c:14
int gui
Definition: mkisofs.c:130
BOOL WINAPI GetGUIThreadInfo(DWORD, LPGUITHREADINFO)
Definition: ntwrapper.h:398

Referenced by thread_proc_0(), thread_proc_1(), and thread_proc_2().

◆ START_TEST()

START_TEST ( SetFocus  )

Definition at line 213 of file SetFocus.c.

214 {
216  Sleep(INTERVAL);
217  ok_int((INT)DialogBoxA(GetModuleHandleA(NULL), "SETFOCUS", NULL, DialogProc_0), IDCLOSE);
218  ok_int((INT)DialogBoxA(GetModuleHandleA(NULL), "SETFOCUS", NULL, DialogProc_1), IDCLOSE);
219 }
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
static INT_PTR CALLBACK DialogProc_0(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: SetFocus.c:115
#define DialogBoxA(i, t, p, f)
Definition: winuser.h:4378
int32_t INT
Definition: typedefs.h:58
static DWORD s_dwMainThreadID
Definition: SetFocus.c:14
#define INTERVAL
Definition: SetFocus.c:12
#define ok_int(expression, result)
Definition: atltest.h:134
static INT_PTR CALLBACK DialogProc_1(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: SetFocus.c:163
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define NULL
Definition: types.h:112

◆ thread_proc_0()

static unsigned __stdcall thread_proc_0 ( void arg)
static

Definition at line 23 of file SetFocus.c.

24 {
25  HWND hwnd = arg;
26 
27  ok_int(GetFocus() == NULL, TRUE);
30 
31  ok_int(GetFocus() == NULL, TRUE);
34 
35  ok_int(GetFocus() == NULL, TRUE);
38 
39  ok_int(GetFocus() == NULL, TRUE);
42 
43  ok_int(GetFocus() == NULL, TRUE);
46  Sleep(INTERVAL);
47 
48  ok_int(GetFocus() == NULL, TRUE);
51  Sleep(INTERVAL);
52 
53  ok_int(GetFocus() == NULL, TRUE);
56  Sleep(INTERVAL);
57 
58  ok_int(GetFocus() == NULL, TRUE);
61  Sleep(INTERVAL);
62 
63  ok_int(GetFocus() == NULL, TRUE);
65 
67  return 0;
68 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define WM_NEXTDLGCTL
Definition: winuser.h:1630
#define KEYEVENTF_KEYUP
Definition: winuser.h:1096
static HWND GetMainThreadFocus(void)
Definition: SetFocus.c:16
#define TRUE
Definition: types.h:120
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void * arg
Definition: msvc.h:10
#define VK_TAB
Definition: winuser.h:2179
#define INTERVAL
Definition: SetFocus.c:12
#define FALSE
Definition: types.h:117
#define psh3
Definition: dlgs.h:114
#define ok_int(expression, result)
Definition: atltest.h:134
#define psh1
Definition: dlgs.h:112
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
#define WM_COMMAND
Definition: winuser.h:1727
#define NULL
Definition: types.h:112
HWND WINAPI GetFocus(void)
Definition: window.c:1909
#define IDCANCEL
Definition: winuser.h:825

Referenced by DialogProc_0().

◆ thread_proc_1()

static unsigned __stdcall thread_proc_1 ( void arg)
static

Definition at line 70 of file SetFocus.c.

71 {
72  HWND hwnd = arg;
73 
74  ok_int(GetFocus() == NULL, TRUE);
77  Sleep(INTERVAL);
78 
79  ok_int(GetFocus() == NULL, TRUE);
82  Sleep(INTERVAL);
83 
84  ok_int(GetFocus() == NULL, TRUE);
86 
88  return 0;
89 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define KEYEVENTF_KEYUP
Definition: winuser.h:1096
static HWND GetMainThreadFocus(void)
Definition: SetFocus.c:16
#define TRUE
Definition: types.h:120
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void * arg
Definition: msvc.h:10
#define VK_TAB
Definition: winuser.h:2179
#define INTERVAL
Definition: SetFocus.c:12
#define psh3
Definition: dlgs.h:114
#define ok_int(expression, result)
Definition: atltest.h:134
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
#define WM_COMMAND
Definition: winuser.h:1727
#define NULL
Definition: types.h:112
HWND WINAPI GetFocus(void)
Definition: window.c:1909

Referenced by DialogProc_1().

◆ thread_proc_2()

static unsigned __stdcall thread_proc_2 ( void arg)
static

Definition at line 91 of file SetFocus.c.

92 {
93  HWND hwnd = arg;
94 
95  ok_int(GetFocus() == NULL, TRUE);
98  Sleep(INTERVAL);
99 
100  ok_int(GetFocus() == NULL, TRUE);
103  Sleep(INTERVAL);
104 
105  ok_int(GetFocus() == NULL, TRUE);
108  Sleep(INTERVAL);
109 
111  return 0;
112 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define KEYEVENTF_KEYUP
Definition: winuser.h:1096
static HWND GetMainThreadFocus(void)
Definition: SetFocus.c:16
#define TRUE
Definition: types.h:120
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
void * arg
Definition: msvc.h:10
#define VK_TAB
Definition: winuser.h:2179
#define INTERVAL
Definition: SetFocus.c:12
#define ok_int(expression, result)
Definition: atltest.h:134
#define psh4
Definition: dlgs.h:115
#define psh1
Definition: dlgs.h:112
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
#define WM_COMMAND
Definition: winuser.h:1727
#define NULL
Definition: types.h:112
HWND WINAPI GetFocus(void)
Definition: window.c:1909
#define IDCANCEL
Definition: winuser.h:825

Referenced by DialogProc_1().

Variable Documentation

◆ s_dwMainThreadID

DWORD s_dwMainThreadID
static

Definition at line 14 of file SetFocus.c.

Referenced by GetMainThreadFocus(), and START_TEST().