ReactOS 0.4.16-dev-197-g92996da
SetActiveWindow.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for SetActiveWindow
5 * PROGRAMMERS: Giannis Adamopoulos
6 */
7
8#include "precomp.h"
9
11
12/* FIXME: test for HWND_TOP, etc...*/
13static int get_iwnd(HWND hWnd)
14{
15 if(hWnd == hWnd1) return 1;
16 else if(hWnd == hWnd2) return 2;
17 else return 0;
18}
19
21{
22 int iwnd = get_iwnd(hWnd);
23
24 if(message > WM_USER || !iwnd || IsDWmMsg(message) || IseKeyMsg(message))
26
27 switch(message)
28 {
30 {
31 HDC hdc = GetDC(0);
33 ok( bits == 8 , "expected WM_QUERYNEWPALETTE only on 8bpp\n");
34 ReleaseDC(0, hdc);
35 return FALSE;
36 }
38 case WM_IME_NOTIFY :
39 case WM_GETICON :
40 case WM_GETTEXT:
41 break;
44 {
45 WINDOWPOS* pwp = (WINDOWPOS*)lParam;
46 ok(wParam==0,"expected wParam=0\n");
48 break;
49 }
50 default:
51 RECORD_MESSAGE(iwnd, message, SENT, 0,0);
52 }
54}
55
56static void FlushMessages()
57{
58 MSG msg;
59
60 while (PeekMessage( &msg, 0, 0, 0, PM_REMOVE ))
61 {
62 int iwnd = get_iwnd(msg.hwnd);
63 if(!(msg.message > WM_USER || !iwnd || IsDWmMsg(msg.message) || IseKeyMsg(msg.message)))
64 RECORD_MESSAGE(iwnd, msg.message, POST,0,0);
66 }
67}
68
70{
72 hWnd1 = CreateWindowW(L"ownertest", L"ownertest", WS_OVERLAPPEDWINDOW,
73 20, 20, 300, 300, NULL, NULL, 0, NULL);
74
75 hWnd2 = CreateWindowW(L"ownertest", L"ownertest", WS_OVERLAPPEDWINDOW,
76 200, 200, 300, 300, NULL, NULL, 0, NULL);
77}
78
79static void set_default_zorder()
80{
83
86}
87
89{
92 UnregisterClassW(L"testClass", 0);
93}
94
96 {2,WM_NCACTIVATE},
97 {2,WM_ACTIVATE},
100 {1,WM_NCACTIVATE},
101 {1,WM_ACTIVATE},
102 {2,WM_KILLFOCUS},
103 {1,WM_SETFOCUS},
104 {0,0}};
105
107 {1,WM_NCACTIVATE},
108 {1,WM_ACTIVATE},
111 {2,WM_NCACTIVATE},
112 {2,WM_ACTIVATE},
113 {1,WM_KILLFOCUS},
114 {2,WM_SETFOCUS},
115 {0,0}};
116
118{
119 SetCursorPos(0,0);
120
123
127
131
133}
134
136{
138}
static void FlushMessages()
static void set_default_zorder()
static MSG_ENTRY activate1to2_chain[]
LRESULT CALLBACK OwnerTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static int get_iwnd(HWND hWnd)
static HWND hWnd1
static void destroy_test_window()
static HWND hWnd2
void Test_msg_simple()
static void create_test_windows()
static MSG_ENTRY activate2to1_chain[]
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define msg(x)
Definition: auth_time.c:54
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define SWP_NOCLIENTSIZE
Definition: msg.h:31
#define SWP_NOCLIENTMOVE
Definition: msg.h:32
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CALLBACK
Definition: compat.h:35
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
#define EMPTY_CACHE()
Definition: msgtrace.h:59
static BOOL IsDWmMsg(UINT msg)
Definition: msgtrace.h:39
#define RECORD_MESSAGE(...)
Definition: msgtrace.h:60
#define COMPARE_CACHE(msg_chain)
Definition: msgtrace.h:57
@ POST
Definition: msgtrace.h:7
@ SENT
Definition: msgtrace.h:6
static BOOL IseKeyMsg(UINT msg)
Definition: msgtrace.h:52
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define DefWindowProc
Definition: ros2win.h:31
Definition: msgtrace.h:15
UINT flags
Definition: winuser.h:3597
HWND hwndInsertAfter
Definition: winuser.h:3592
Definition: tftpd.h:60
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
LONG_PTR LPARAM
Definition: windef.h:208
LONG_PTR LRESULT
Definition: windef.h:209
UINT_PTR WPARAM
Definition: windef.h:207
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define BITSPIXEL
Definition: wingdi.h:720
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define WM_QUERYNEWPALETTE
Definition: winuser.h:1881
#define SWP_NOREPOSITION
Definition: winuser.h:1253
#define WM_IME_NOTIFY
Definition: winuser.h:1833
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1664
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1247
#define WM_SETFOCUS
Definition: winuser.h:1616
#define SWP_NOSIZE
Definition: winuser.h:1248
#define WM_GETTEXT
Definition: winuser.h:1621
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2714
#define WM_ACTIVATE
Definition: winuser.h:1615
#define WM_IME_SETCONTEXT
Definition: winuser.h:1832
#define WM_NCACTIVATE
Definition: winuser.h:1691
HWND WINAPI SetActiveWindow(_In_ HWND)
#define PM_REMOVE
Definition: winuser.h:1199
#define SWP_SHOWWINDOW
Definition: winuser.h:1251
#define PeekMessage
Definition: winuser.h:5842
HDC WINAPI GetDC(_In_opt_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4319
#define WM_USER
Definition: winuser.h:1898
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1665
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WM_KILLFOCUS
Definition: winuser.h:1617