ReactOS 0.4.15-dev-8219-ge8b88cf
SetActiveWindow.c File Reference
#include "precomp.h"
Include dependency graph for SetActiveWindow.c:

Go to the source code of this file.

Functions

static int get_iwnd (HWND hWnd)
 
LRESULT CALLBACK OwnerTestProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void FlushMessages ()
 
static void create_test_windows ()
 
static void set_default_zorder ()
 
static void destroy_test_window ()
 
void Test_msg_simple ()
 
 START_TEST (SetActiveWindow)
 

Variables

static HWND hWnd1
 
static HWND hWnd2
 
static MSG_ENTRY activate2to1_chain []
 
static MSG_ENTRY activate1to2_chain []
 

Function Documentation

◆ create_test_windows()

static void create_test_windows ( )
static

Definition at line 69 of file SetActiveWindow.c.

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}
LRESULT CALLBACK OwnerTestProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
static HWND hWnd1
static HWND hWnd2
#define NULL
Definition: types.h:112
#define L(x)
Definition: ntvdm.h:50
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
static __inline ATOM RegisterSimpleClass(WNDPROC lpfnWndProc, LPCWSTR lpszClassName)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4316

Referenced by Test_msg_simple().

◆ destroy_test_window()

static void destroy_test_window ( )
static

Definition at line 88 of file SetActiveWindow.c.

89{
92 UnregisterClassW(L"testClass", 0);
93}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by Test_msg_simple().

◆ FlushMessages()

static void FlushMessages ( )
static

Definition at line 56 of file SetActiveWindow.c.

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}
static int get_iwnd(HWND hWnd)
#define msg(x)
Definition: auth_time.c:54
static BOOL IsDWmMsg(UINT msg)
Definition: msgtrace.h:39
#define RECORD_MESSAGE(...)
Definition: msgtrace.h:60
@ POST
Definition: msgtrace.h:7
static BOOL IseKeyMsg(UINT msg)
Definition: msgtrace.h:52
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define PM_REMOVE
Definition: winuser.h:1196
#define PeekMessage
Definition: winuser.h:5839
#define WM_USER
Definition: winuser.h:1895

Referenced by set_default_zorder(), and Test_msg_simple().

◆ get_iwnd()

static int get_iwnd ( HWND  hWnd)
static

Definition at line 13 of file SetActiveWindow.c.

14{
15 if(hWnd == hWnd1) return 1;
16 else if(hWnd == hWnd2) return 2;
17 else return 0;
18}
HWND hWnd
Definition: settings.c:17

Referenced by FlushMessages(), and OwnerTestProc().

◆ OwnerTestProc()

LRESULT CALLBACK OwnerTestProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 20 of file SetActiveWindow.c.

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}
#define ok(value,...)
Definition: atltest.h:57
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define FALSE
Definition: types.h:117
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:92
@ SENT
Definition: msgtrace.h:6
#define DefWindowProc
Definition: ros2win.h:31
UINT flags
Definition: winuser.h:3594
HWND hwndInsertAfter
Definition: winuser.h:3589
Definition: tftpd.h:60
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define BITSPIXEL
Definition: wingdi.h:720
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define WM_QUERYNEWPALETTE
Definition: winuser.h:1878
#define WM_IME_NOTIFY
Definition: winuser.h:1830
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1661
#define WM_GETTEXT
Definition: winuser.h:1618
#define WM_IME_SETCONTEXT
Definition: winuser.h:1829
HDC WINAPI GetDC(_In_opt_ HWND)
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1662

Referenced by create_test_windows().

◆ set_default_zorder()

static void set_default_zorder ( )
static

Definition at line 79 of file SetActiveWindow.c.

80{
83
86}
static void FlushMessages()
#define EMPTY_CACHE()
Definition: msgtrace.h:59
#define SWP_NOREPOSITION
Definition: winuser.h:1250
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1244
#define SWP_NOSIZE
Definition: winuser.h:1245
#define SWP_SHOWWINDOW
Definition: winuser.h:1248

Referenced by Test_msg_simple().

◆ START_TEST()

START_TEST ( SetActiveWindow  )

Definition at line 135 of file SetActiveWindow.c.

136{
138}
void Test_msg_simple()

◆ Test_msg_simple()

void Test_msg_simple ( )

Definition at line 117 of file SetActiveWindow.c.

118{
119 SetCursorPos(0,0);
120
123
127
131
133}
static void set_default_zorder()
static MSG_ENTRY activate1to2_chain[]
static void destroy_test_window()
static void create_test_windows()
static MSG_ENTRY activate2to1_chain[]
#define COMPARE_CACHE(msg_chain)
Definition: msgtrace.h:57
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2693
HWND WINAPI SetActiveWindow(_In_ HWND)

Referenced by START_TEST().

Variable Documentation

◆ activate1to2_chain

MSG_ENTRY activate1to2_chain[]
static
Initial value:
={
{0,0}}
#define SWP_NOCLIENTSIZE
Definition: msg.h:29
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
#define WM_SETFOCUS
Definition: winuser.h:1613
#define WM_ACTIVATE
Definition: winuser.h:1612
#define WM_NCACTIVATE
Definition: winuser.h:1688
#define WM_KILLFOCUS
Definition: winuser.h:1614

Definition at line 106 of file SetActiveWindow.c.

Referenced by Test_msg_simple().

◆ activate2to1_chain

MSG_ENTRY activate2to1_chain[]
static

◆ hWnd1

◆ hWnd2