ReactOS 0.4.15-dev-8236-g99f0937
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{
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}
static unsigned __stdcall thread_proc_0(void *arg)
Definition: SetFocus.c:23
#define ok_int(expression, result)
Definition: atltest.h:134
WPARAM wParam
Definition: combotst.c:138
#define psh1
Definition: dlgs.h:112
#define psh2
Definition: dlgs.h:113
#define psh3
Definition: dlgs.h:114
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
HANDLE hThread
Definition: wizard.c:28
#define LOWORD(l)
Definition: pedump.c:82
_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)
PVOID HANDLE
Definition: typedefs.h:73
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
HWND WINAPI GetFocus(void)
Definition: window.c:1893
#define IDCANCEL
Definition: winuser.h:831
#define WM_COMMAND
Definition: winuser.h:1740
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_INITDIALOG
Definition: winuser.h:1739
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:830
#define WM_NEXTDLGCTL
Definition: winuser.h:1643
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

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{
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}
static unsigned __stdcall thread_proc_2(void *arg)
Definition: SetFocus.c:91
static unsigned __stdcall thread_proc_1(void *arg)
Definition: SetFocus.c:70
#define psh4
Definition: dlgs.h:115
#define SW_HIDE
Definition: winuser.h:768
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SW_SHOW
Definition: winuser.h:775

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{
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}
#define INTERVAL
Definition: SetFocus.c:12
static INT_PTR CALLBACK DialogProc_0(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: SetFocus.c:115
static INT_PTR CALLBACK DialogProc_1(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: SetFocus.c:163
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define DialogBoxA(i, t, p, f)
Definition: winuser.h:4398

◆ 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);
47
48 ok_int(GetFocus() == NULL, TRUE);
52
53 ok_int(GetFocus() == NULL, TRUE);
57
58 ok_int(GetFocus() == NULL, TRUE);
62
63 ok_int(GetFocus() == NULL, TRUE);
65
67 return 0;
68}
static HWND GetMainThreadFocus(void)
Definition: SetFocus.c:16
void * arg
Definition: msvc.h:10
#define VK_TAB
Definition: winuser.h:2199
VOID WINAPI keybd_event(_In_ BYTE, _In_ BYTE, _In_ DWORD, _In_ ULONG_PTR)
#define KEYEVENTF_KEYUP
Definition: winuser.h:1102

Referenced by DialogProc_0().

◆ thread_proc_1()

static unsigned __stdcall thread_proc_1 ( void arg)
static

Definition at line 70 of file SetFocus.c.

Referenced by DialogProc_1().

◆ thread_proc_2()

static unsigned __stdcall thread_proc_2 ( void arg)
static

Definition at line 91 of file SetFocus.c.

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().