ReactOS 0.4.15-dev-8093-g3285f69
win.c File Reference
#include "precomp.h"
Include dependency graph for win.c:

Go to the source code of this file.

Classes

struct  wm_gettext_override_data
 
struct  create_window_thread_params
 
struct  dialog_param
 
struct  dlg_parent_param
 
struct  parentdc_stat
 
struct  parentdc_test
 
struct  window_attributes
 
struct  smresult_thread_data
 
struct  set_foreground_thread_params
 

Macros

#define SPI_GETDESKWALLPAPER   0x0073
 
#define WM_SYSTIMER   0x0118
 
#define LONG_PTR   INT_PTR
 
#define ULONG_PTR   UINT_PTR
 
#define COUNTOF(arr)   (sizeof(arr)/sizeof(arr[0]))
 
#define check_wnd_state(a, b, c, d)   check_wnd_state_(__FILE__,__LINE__,a,b,c,d)
 
#define check_active_state(a, b, c)   check_active_state_(__FILE__,__LINE__,a,b,c)
 
#define check_z_order(hwnd, next, prev, owner, topmost)
 
#define TEST_MOUSEACTIVATE(A, B)
 
#define SHOWSYSMETRIC(SM)   trace(#SM "=%d\n", GetSystemMetrics(SM))
 
#define parentdc_field_ok(t, w, r, f, got)
 
#define parentdc_todo_field_ok(t, w, r, f, got)
 
#define parentdc_rect_ok(t, w, r, got)
 
#define parentdc_win_ok(t, w, got)
 
#define parentdc_ok(t, got)
 
#define nothing_todo   {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}
 
#define expect_menu(window, menu)
 
#define expect_style(window, style)    ok((ULONG)GetWindowLongA(window, GWL_STYLE) == (style), "expected style %x != %x\n", (LONG)(style), GetWindowLongA(window, GWL_STYLE))
 
#define expect_ex_style(window, ex_style)    ok((ULONG)GetWindowLongA(window, GWL_EXSTYLE) == (ex_style), "expected ex_style %x != %x\n", (LONG)(ex_style), GetWindowLongA(window, GWL_EXSTYLE))
 
#define expect_gle_broken_9x(gle)
 
#define NUMBER_OF_THICK_CHILD_TESTS   16
 
#define SET_FOREGROUND_STEAL_1   0x01
 
#define SET_FOREGROUND_SET_1   0x02
 
#define SET_FOREGROUND_STEAL_2   0x04
 
#define SET_FOREGROUND_SET_2   0x08
 
#define SET_FOREGROUND_INJECT   0x10
 

Functions

void dump_region (HRGN hrgn)
 
static HWND (WINAPI *pGetAncestor)(HWND
 
static BOOL (WINAPI *pGetWindowInfo)(HWND
 
static WINDOWINFO *static UINT (WINAPI *pGetWindowModuleFileNameA)(HWND
 
static HMONITOR (WINAPI *pMonitorFromPoint)(POINT
 
static int (WINAPI *pGetWindowRgnBox)(HWND
 
static DWORD (WINAPI *pSetLayout)(HDC hdc
 
static void dump_minmax_info (const MINMAXINFO *minmax)
 
static void flush_events (BOOL remove_messages)
 
static BOOL wait_for_event (HANDLE event, int timeout)
 
static void check_parents (HWND hwnd, HWND ga_parent, HWND gwl_parent, HWND get_parent, HWND gw_owner, HWND ga_root, HWND ga_root_owner)
 
static void check_wnd_state_ (const char *file, int line, HWND active, HWND foreground, HWND focus, HWND capture)
 
static void check_active_state_ (const char *file, int line, HWND active, HWND foreground, HWND focus)
 
static BOOL ignore_message (UINT message)
 
static BOOL CALLBACK EnumChildProc (HWND hwndChild, LPARAM lParam)
 
static BOOL CALLBACK EnumChildProc1 (HWND hwndChild, LPARAM lParam)
 
static HWND create_tool_window (LONG style, HWND parent)
 
static void test_parent_owner (void)
 
static BOOL CALLBACK enum_proc (HWND hwnd, LPARAM lParam)
 
static DWORD CALLBACK enum_thread (void *arg)
 
static void test_enum_thread_windows (void)
 
static LRESULT WINAPI main_window_procA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI main_window_procW (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI tool_window_procA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static BOOL RegisterWindowClasses (void)
 
static void verify_window_info (const char *hook, HWND hwnd, const WINDOWINFO *info)
 
static void FixedAdjustWindowRectEx (RECT *rc, LONG style, BOOL menu, LONG exstyle)
 
static void wine_AdjustWindowRectEx (RECT *rect, LONG style, BOOL menu, LONG exStyle)
 
static void test_nonclient_area (HWND hwnd)
 
static LRESULT CALLBACK cbt_hook_proc (int nCode, WPARAM wParam, LPARAM lParam)
 
static void test_shell_window (void)
 
static void test_MDI_create (HWND parent, HWND mdi_client, INT_PTR first_id)
 
static void test_MDI_child_stack (HWND mdi_client)
 
static void MDI_ChildGetMinMaxInfo (HWND client, HWND hwnd, MINMAXINFO *lpMinMax)
 
static LRESULT WINAPI mdi_child_wnd_proc_1 (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI mdi_child_wnd_proc_2 (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI mdi_main_wnd_procA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static BOOL mdi_RegisterWindowClasses (void)
 
static void test_mdi (void)
 
static void test_icons (void)
 
static LRESULT WINAPI nccalcsize_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_SetWindowPos (HWND hwnd, HWND hwnd2)
 
static void test_SetMenu (HWND parent)
 
static void test_window_tree (HWND parent, const DWORD *style, const int *order, int total)
 
static void test_children_zorder (HWND parent)
 
static void check_z_order_debug (HWND hwnd, HWND next, HWND prev, HWND owner, BOOL topmost, const char *file, int line)
 
static void test_popup_zorder (HWND hwnd_D, HWND hwnd_E, DWORD style)
 
static void test_vis_rgn (HWND hwnd)
 
static LRESULT WINAPI set_focus_on_activate_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static void test_SetFocus (HWND hwnd)
 
static void test_SetActiveWindow (HWND hwnd)
 
static DWORD WINAPI create_window_thread (void *param)
 
static void test_SetForegroundWindow (HWND hwnd)
 
static LRESULT WINAPI button_hook_proc (HWND button, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_capture_1 (void)
 
static void test_capture_2 (void)
 
static void test_capture_3 (HWND hwnd1, HWND hwnd2)
 
static LRESULT CALLBACK test_capture_4_proc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_capture_4 (void)
 
static BOOL peek_message (MSG *msg)
 
static void test_keyboard_input (HWND hwnd)
 
static BOOL wait_for_message (MSG *msg)
 
static void test_mouse_input (HWND hwnd)
 
static void test_validatergn (HWND hwnd)
 
static void nccalchelper (HWND hwnd, INT x, INT y, RECT *prc)
 
static void test_nccalcscroll (HWND parent)
 
static void test_SetParent (void)
 
static LRESULT WINAPI StyleCheckProc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void register_style_check_class (void)
 
static void check_window_style (DWORD dwStyleIn, DWORD dwExStyleIn, DWORD dwStyleOut, DWORD dwExStyleOut)
 
static void test_window_styles (void)
 
static HWND root_dialog (HWND hwnd)
 
static INT_PTR WINAPI empty_dlg_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR WINAPI empty_dlg_proc3 (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR WINAPI empty_dlg_proc2 (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void check_dialog_style (DWORD style_in, DWORD ex_style_in, DWORD style_out, DWORD ex_style_out)
 
static void test_dialog_styles (void)
 
static INT_PTR WINAPI parent_dlg_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR WINAPI reparent_dlg_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR WINAPI reparent_owned_dlg_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI reparent_dialog_owner_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI post_quit_dialog_owner_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI destroy_dialog_owner_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_dialog_parent (void)
 
static void test_scrollwindow (HWND hwnd)
 
static void test_scrollvalidate (HWND parent)
 
static void test_scroll (void)
 
static void test_scrolldc (HWND parent)
 
static void test_params (void)
 
static void test_AWRwindow (LPCSTR class, LONG style, LONG exStyle, BOOL menu)
 
static BOOL AWR_init (void)
 
static void test_AWR_window_size (BOOL menu)
 
static void test_AWR_flags (void)
 
static void test_AdjustWindowRect (void)
 
static LRESULT WINAPI redraw_window_procA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_redrawnow (void)
 
static LRESULT WINAPI parentdc_window_procA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void zero_parentdc_stat (struct parentdc_stat *t)
 
static void zero_parentdc_test (struct parentdc_test *t)
 
static void test_csparentdc (void)
 
static LRESULT WINAPI def_window_procA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI def_window_procW (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_IsWindowUnicode (void)
 
static LRESULT CALLBACK minmax_wnd_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static LRESULT CALLBACK winsizes_wnd_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static void test_CreateWindow (void)
 
static int check_error (DWORD actual, DWORD expected)
 
static void test_SetWindowLong (void)
 
static LRESULT WINAPI check_style_wnd_proc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
static void test_set_window_style (void)
 
static void test_ShowWindow (void)
 
static DWORD CALLBACK gettext_msg_thread (LPVOID arg)
 
static DWORD CALLBACK settext_msg_thread (LPVOID arg)
 
static void test_gettext (void)
 
static void test_GetUpdateRect (void)
 
static LRESULT CALLBACK TestExposedRegion_WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void test_Expose (void)
 
static LRESULT CALLBACK TestNCRedraw_WndProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
static void run_NCRedrawLoop (UINT flags)
 
static void test_NCRedraw (void)
 
static void test_GetWindowModuleFileName (void)
 
static void test_hwnd_message (void)
 
static void test_layered_window (void)
 
static LRESULT CALLBACK fullscreen_wnd_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static void test_fullscreen (void)
 
static LRESULT WINAPI test_thick_child_size_winproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_thick_child_size (HWND parentWindow)
 
static void test_handles (HWND full_hwnd)
 
static void test_winregion (void)
 
static void test_rtl_layout (void)
 
static void test_FlashWindow (void)
 
static void test_FlashWindowEx (void)
 
static void test_FindWindowEx (void)
 
static void test_GetLastActivePopup (void)
 
static LRESULT WINAPI my_httrasparent_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static LRESULT WINAPI my_window_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static void create_window_tree (HWND parent, HWND *window, int size)
 
static void get_window_attributes (HWND hwnd, struct window_attributes *attrs)
 
static int window_to_index (HWND hwnd, HWND *window, int size)
 
static void test_child_window_from_point (void)
 
static void simulate_click (int x, int y)
 
static LRESULT WINAPI static_hook_proc (HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
 
static void window_from_point_proc (HWND parent)
 
static void test_window_from_point (const char *argv0)
 
static void test_map_points (void)
 
static void test_update_region (void)
 
static void test_window_without_child_style (void)
 
static LRESULT WINAPI smresult_wndproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static DWORD WINAPI smresult_thread_proc (void *param)
 
static void test_smresult (void)
 
static void test_GetMessagePos (void)
 
static DWORD WINAPI set_foreground_thread (void *params)
 
static void test_activateapp (HWND window1)
 
static LRESULT WINAPI winproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI winproc_convA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI winproc_convW (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_winproc_handles (const char *argv0)
 
static void test_winproc_limit (void)
 
static void test_deferwindowpos (void)
 
 START_TEST (win)
 

Variables

static UINT
 
static WINDOWINFO *static LPSTR
 
static COLORREF BYTE DWORD *static COLORREF
 
static COLORREF BYTE DWORD *static BYTE
 
static COLORREF BYTE DWORD *static DWORD
 
static HDC
 
static const UPDATELAYEREDWINDOWINFO *static LPMONITORINFO
 
static LPRECT
 
static BOOL bInvert
 
static DWORD layout
 
static HRGN hrgn
 
static BOOL test_lbuttondown_flag
 
static DWORD num_gettext_msgs
 
static DWORD num_settext_msgs
 
static HWND hwndMessage
 
static HWND hwndMain
 
static HWND hwndMain2
 
static HHOOK hhook
 
static BOOL app_activated
 
static BOOL app_deactivated
 
static const charszAWRClass = "Winsize"
 
static HMENU hmenu
 
static DWORD our_pid
 
static BOOL is_win9x = FALSE
 
static struct wm_gettext_override_data g_wm_gettext_override
 
static const WCHAR mainclassW [] = {'M','a','i','n','W','i','n','d','o','w','C','l','a','s','s','W',0}
 
static char mdi_lParam_test_message [] = "just a test string"
 
static WNDPROC old_button_proc
 
static ATOM atomStyleCheckClass
 
static LRESULT expected_id
 
static int redrawComplete
 
static int WMPAINT_count
 
static int expected_cx
 
static int expected_cy
 
static RECT expected_rect
 
static RECT broken_rect
 
static MONITORINFO mi
 
static BOOL test_thick_child_got_minmax
 
static const chartest_thick_child_name
 
static LONG test_thick_child_style
 
static LONG test_thick_child_exStyle
 
static WNDPROC def_static_proc
 
static BOOL got_hittest
 
static const WCHAR textW [] = {'t','e','x','t',0}
 

Macro Definition Documentation

◆ check_active_state

#define check_active_state (   a,
  b,
  c 
)    check_active_state_(__FILE__,__LINE__,a,b,c)

Definition at line 159 of file win.c.

◆ check_wnd_state

#define check_wnd_state (   a,
  b,
  c,
  d 
)    check_wnd_state_(__FILE__,__LINE__,a,b,c,d)

Definition at line 143 of file win.c.

◆ check_z_order

#define check_z_order (   hwnd,
  next,
  prev,
  owner,
  topmost 
)
Value:
check_z_order_debug((hwnd), (next), (prev), (owner), (topmost), \
__FILE__, __LINE__)
static unsigned __int64 next
Definition: rand_nt.c:6
static void check_z_order_debug(HWND hwnd, HWND next, HWND prev, HWND owner, BOOL topmost, const char *file, int line)
Definition: win.c:2795
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Definition at line 2791 of file win.c.

◆ COUNTOF

#define COUNTOF (   arr)    (sizeof(arr)/sizeof(arr[0]))

Definition at line 71 of file win.c.

◆ expect_ex_style

#define expect_ex_style (   window,
  ex_style 
)     ok((ULONG)GetWindowLongA(window, GWL_EXSTYLE) == (ex_style), "expected ex_style %x != %x\n", (LONG)(ex_style), GetWindowLongA(window, GWL_EXSTYLE))

◆ expect_gle_broken_9x

#define expect_gle_broken_9x (   gle)
Value:
ok(GetLastError() == gle ||\
broken(GetLastError() == 0xdeadbeef),\
"IsMenu set error %d\n", GetLastError())
#define broken(x)
Definition: _sntprintf.h:21
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI GetLastError(void)
Definition: except.c:1042

◆ expect_menu

#define expect_menu (   window,
  menu 
)
Value:
SetLastError(0xdeadbeef); \
res = (GetMenu(window) == (HMENU)menu); \
ok(res, "GetMenu error %d\n", GetLastError())
#define SetLastError(x)
Definition: compat.h:752
GLuint res
Definition: glext.h:9613
static IHTMLWindow2 * window
Definition: events.c:77
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
HMENU WINAPI GetMenu(_In_ HWND)

◆ expect_style

#define expect_style (   window,
  style 
)     ok((ULONG)GetWindowLongA(window, GWL_STYLE) == (style), "expected style %x != %x\n", (LONG)(style), GetWindowLongA(window, GWL_STYLE))

◆ LONG_PTR

Definition at line 33 of file win.c.

◆ nothing_todo

#define nothing_todo   {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}

◆ NUMBER_OF_THICK_CHILD_TESTS

#define NUMBER_OF_THICK_CHILD_TESTS   16

Definition at line 7609 of file win.c.

◆ parentdc_field_ok

#define parentdc_field_ok (   t,
  w,
  r,
  f,
  got 
)
Value:
ok (t.w.r.f==got.w.r.f, "window " #w ", rect " #r ", field " #f \
": expected %d, got %d\n", \
t.w.r.f, got.w.r.f)
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
GLfloat f
Definition: glext.h:7540
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102

Definition at line 5485 of file win.c.

◆ parentdc_ok

#define parentdc_ok (   t,
  got 
)
Value:
parentdc_win_ok(t, child1, got); \
parentdc_win_ok(t, child2, got);
int main()
Definition: test.c:6
#define parentdc_win_ok(t, w, got)
Definition: win.c:5500

Definition at line 5505 of file win.c.

◆ parentdc_rect_ok

#define parentdc_rect_ok (   t,
  w,
  r,
  got 
)
Value:
parentdc_todo_field_ok(t, w, r, top, got); \
parentdc_todo_field_ok(t, w, r, right, got); \
parentdc_todo_field_ok(t, w, r, bottom, got);
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
#define parentdc_todo_field_ok(t, w, r, f, got)
Definition: win.c:5490

Definition at line 5494 of file win.c.

◆ parentdc_todo_field_ok

#define parentdc_todo_field_ok (   t,
  w,
  r,
  f,
  got 
)
Value:
todo_wine_if (t.w##_todo.r.f) \
parentdc_field_ok(t, w, r, f, got);
#define todo_wine_if(is_todo)
Definition: custom.c:76

Definition at line 5490 of file win.c.

◆ parentdc_win_ok

#define parentdc_win_ok (   t,
  w,
  got 
)
Value:
parentdc_rect_ok(t, w, clip, got); \
parentdc_rect_ok(t, w, paint, got);
static FILE * client
Definition: client.c:41
#define parentdc_rect_ok(t, w, r, got)
Definition: win.c:5494

Definition at line 5500 of file win.c.

◆ SET_FOREGROUND_INJECT

#define SET_FOREGROUND_INJECT   0x10

Definition at line 9011 of file win.c.

◆ SET_FOREGROUND_SET_1

#define SET_FOREGROUND_SET_1   0x02

Definition at line 9008 of file win.c.

◆ SET_FOREGROUND_SET_2

#define SET_FOREGROUND_SET_2   0x08

Definition at line 9010 of file win.c.

◆ SET_FOREGROUND_STEAL_1

#define SET_FOREGROUND_STEAL_1   0x01

Definition at line 9007 of file win.c.

◆ SET_FOREGROUND_STEAL_2

#define SET_FOREGROUND_STEAL_2   0x04

Definition at line 9009 of file win.c.

◆ SHOWSYSMETRIC

#define SHOWSYSMETRIC (   SM)    trace(#SM "=%d\n", GetSystemMetrics(SM))

Definition at line 5343 of file win.c.

◆ SPI_GETDESKWALLPAPER

#define SPI_GETDESKWALLPAPER   0x0073

Definition at line 26 of file win.c.

◆ TEST_MOUSEACTIVATE

#define TEST_MOUSEACTIVATE (   A,
  B 
)
Value:
ok(res == B, "WM_MOUSEACTIVATE for %s returned %ld\n", #A, res);
Definition: ehthrow.cxx:93
Definition: ehthrow.cxx:54
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MAKELRESULT(l, h)
Definition: winuser.h:4010
#define WM_MOUSEACTIVATE
Definition: winuser.h:1637

◆ ULONG_PTR

Definition at line 34 of file win.c.

◆ WM_SYSTIMER

#define WM_SYSTIMER   0x0118

Definition at line 30 of file win.c.

Function Documentation

◆ AWR_init()

static BOOL AWR_init ( void  )
static

Definition at line 5262 of file win.c.

5263{
5264 WNDCLASSA class;
5265
5266 class.style = CS_HREDRAW | CS_VREDRAW;
5267 class.lpfnWndProc = DefWindowProcA;
5268 class.cbClsExtra = 0;
5269 class.cbWndExtra = 0;
5270 class.hInstance = 0;
5271 class.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
5272 class.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
5273 class.hbrBackground = 0;
5274 class.lpszMenuName = 0;
5275 class.lpszClassName = szAWRClass;
5276
5277 if (!RegisterClassA(&class)) {
5278 ok(FALSE, "RegisterClass failed\n");
5279 return FALSE;
5280 }
5281
5282 hmenu = CreateMenu();
5283 if (!hmenu)
5284 return FALSE;
5285 ok(hmenu != 0, "Failed to create menu\n");
5286 ok(AppendMenuA(hmenu, MF_STRING, 1, "Test!"), "Failed to create menu item\n");
5287
5288 return TRUE;
5289}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
UINT style
Definition: winuser.h:3163
static const char * szAWRClass
Definition: win.c:65
static HMENU hmenu
Definition: win.c:66
#define CS_VREDRAW
Definition: winuser.h:658
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HMENU WINAPI CreateMenu(void)
Definition: menu.c:829
#define CS_HREDRAW
Definition: winuser.h:653
#define MF_STRING
Definition: winuser.h:138
#define IDC_ARROW
Definition: winuser.h:687
#define IDI_APPLICATION
Definition: winuser.h:704
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON WINAPI LoadIconA(_In_opt_ HINSTANCE hInstance, _In_ LPCSTR lpIconName)
Definition: cursoricon.c:2091
BOOL WINAPI AppendMenuA(_In_ HMENU, _In_ UINT, _In_ UINT_PTR, _In_opt_ LPCSTR)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2121
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by test_AdjustWindowRect().

◆ BOOL()

static BOOL ( WINAPI pGetWindowInfo)
static

◆ button_hook_proc()

static LRESULT WINAPI button_hook_proc ( HWND  button,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 3291 of file win.c.

3292{
3293 LRESULT ret;
3294 USHORT key_state;
3295
3296 key_state = GetKeyState(VK_LBUTTON);
3297 ok(!(key_state & 0x8000), "VK_LBUTTON should not be pressed, state %04x\n", key_state);
3298
3300
3301 if (msg == WM_LBUTTONDOWN)
3302 {
3303 HWND hwnd, capture;
3304
3306
3307 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL);
3308 assert(hwnd);
3309 trace("hwnd %p\n", hwnd);
3310
3312
3314
3316
3318
3319 hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP, 0, 0, 10, 10, 0, 0, 0, NULL);
3320 assert(hwnd);
3321 trace("hwnd %p\n", hwnd);
3322
3324
3325 /* button wnd proc should release capture on WM_KILLFOCUS if it does
3326 * match internal button state.
3327 */
3330
3333
3334 capture = SetCapture(hwnd);
3335 ok(capture == 0, "SetCapture() = %p\n", capture);
3336
3338
3340
3342 }
3343
3344 return ret;
3345}
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define trace
Definition: atltest.h:70
#define msg(x)
Definition: auth_time.c:54
#define NULL
Definition: types.h:112
#define assert(x)
Definition: debug.h:53
DWORD button
Definition: button.c:166
#define WS_POPUP
Definition: pedump.c:616
unsigned short USHORT
Definition: pedump.c:61
int ret
static WNDPROC old_button_proc
Definition: win.c:3289
#define check_wnd_state(a, b, c, d)
Definition: win.c:143
LONG_PTR LRESULT
Definition: windef.h:209
HWND WINAPI SetCapture(_In_ HWND hWnd)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SW_SHOWNOACTIVATE
Definition: winuser.h:774
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
#define SW_SHOW
Definition: winuser.h:775
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WM_KILLFOCUS
Definition: winuser.h:1614
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
SHORT WINAPI GetKeyState(_In_ int)
#define VK_LBUTTON
Definition: winuser.h:2190

Referenced by test_capture_1().

◆ cbt_hook_proc()

static LRESULT CALLBACK cbt_hook_proc ( int  nCode,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1118 of file win.c.

1119{
1120 static const char *CBT_code_name[10] = {
1121 "HCBT_MOVESIZE",
1122 "HCBT_MINMAX",
1123 "HCBT_QS",
1124 "HCBT_CREATEWND",
1125 "HCBT_DESTROYWND",
1126 "HCBT_ACTIVATE",
1127 "HCBT_CLICKSKIPPED",
1128 "HCBT_KEYSKIPPED",
1129 "HCBT_SYSCOMMAND",
1130 "HCBT_SETFOCUS" };
1131 const char *code_name = (nCode >= 0 && nCode <= HCBT_SETFOCUS) ? CBT_code_name[nCode] : "Unknown";
1132 HWND hwnd = (HWND)wParam;
1133
1134 switch (nCode)
1135 {
1136 case HCBT_CREATEWND:
1137 {
1138 static const RECT rc_null;
1139 RECT rc;
1140 LONG style;
1141 CBT_CREATEWNDA *createwnd = (CBT_CREATEWNDA *)lParam;
1142 ok(createwnd->hwndInsertAfter == HWND_TOP, "hwndInsertAfter should be always HWND_TOP\n");
1143
1144 if (pGetWindowInfo)
1145 {
1147 info.cbSize = sizeof(WINDOWINFO);
1148 ok(pGetWindowInfo(hwnd, &info), "GetWindowInfo should not fail\n");
1149 verify_window_info(code_name, hwnd, &info);
1150 }
1151
1152 /* WS_VISIBLE should be turned off yet */
1153 style = createwnd->lpcs->style & ~WS_VISIBLE;
1155 "style of hwnd and style in the CREATESTRUCT do not match: %08x != %08x\n",
1157
1158 if (0)
1159 {
1160 /* Uncomment this once the test succeeds in all cases */
1161 if ((style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
1162 {
1164 "wrong result from GetParent %p: message window %p\n",
1166 }
1167 else
1168 ok(!GetParent(hwnd), "GetParent should return 0 at this point\n");
1169
1170 ok(!GetWindow(hwnd, GW_OWNER), "GW_OWNER should be set to 0 at this point\n");
1171 }
1172 if (0)
1173 {
1174 /* while NT assigns GW_HWNDFIRST/LAST some values at this point,
1175 * Win9x still has them set to 0.
1176 */
1177 ok(GetWindow(hwnd, GW_HWNDFIRST) != 0, "GW_HWNDFIRST should not be set to 0 at this point\n");
1178 ok(GetWindow(hwnd, GW_HWNDLAST) != 0, "GW_HWNDLAST should not be set to 0 at this point\n");
1179 }
1180 ok(!GetWindow(hwnd, GW_HWNDPREV), "GW_HWNDPREV should be set to 0 at this point\n");
1181 ok(!GetWindow(hwnd, GW_HWNDNEXT), "GW_HWNDNEXT should be set to 0 at this point\n");
1182
1183 if (0)
1184 {
1185 /* Uncomment this once the test succeeds in all cases */
1186 if (pGetAncestor)
1187 {
1188 ok(pGetAncestor(hwnd, GA_PARENT) == hwndMessage, "GA_PARENT should be set to hwndMessage at this point\n");
1189 ok(pGetAncestor(hwnd, GA_ROOT) == hwnd,
1190 "GA_ROOT is set to %p, expected %p\n", pGetAncestor(hwnd, GA_ROOT), hwnd);
1191
1192 if ((style & (WS_CHILD|WS_POPUP)) == WS_CHILD)
1193 ok(pGetAncestor(hwnd, GA_ROOTOWNER) == hwndMessage,
1194 "GA_ROOTOWNER should be set to hwndMessage at this point\n");
1195 else
1196 ok(pGetAncestor(hwnd, GA_ROOTOWNER) == hwnd,
1197 "GA_ROOTOWNER is set to %p, expected %p\n", pGetAncestor(hwnd, GA_ROOTOWNER), hwnd);
1198 }
1199
1200 ok(GetWindowRect(hwnd, &rc), "GetWindowRect failed\n");
1201 ok(EqualRect(&rc, &rc_null), "window rect should be set to 0 HCBT_CREATEWND\n");
1202 ok(GetClientRect(hwnd, &rc), "GetClientRect failed\n");
1203 ok(EqualRect(&rc, &rc_null), "client rect should be set to 0 on HCBT_CREATEWND\n");
1204 }
1205 break;
1206 }
1207 case HCBT_MOVESIZE:
1208 case HCBT_MINMAX:
1209 case HCBT_ACTIVATE:
1210 if (pGetWindowInfo && IsWindow(hwnd))
1211 {
1213
1214 /* Win98 actually does check the info.cbSize and doesn't allow
1215 * it to be anything except sizeof(WINDOWINFO), while Win95, Win2k,
1216 * WinXP do not check it at all.
1217 */
1218 info.cbSize = sizeof(WINDOWINFO);
1219 ok(pGetWindowInfo(hwnd, &info), "GetWindowInfo should not fail\n");
1220 verify_window_info(code_name, hwnd, &info);
1221 }
1222 break;
1223 /* window state is undefined */
1224 case HCBT_SETFOCUS:
1225 case HCBT_DESTROYWND:
1226 break;
1227 default:
1228 break;
1229 }
1230
1231 return CallNextHookEx(hhook, nCode, wParam, lParam);
1232}
Arabic default style
Definition: afstyles.h:94
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
HANDLE HWND
Definition: compat.h:19
#define WS_CHILD
Definition: pedump.c:617
long LONG
Definition: pedump.c:60
LPCREATESTRUCTA lpcs
Definition: winuser.h:2970
HWND hwndInsertAfter
Definition: winuser.h:2971
static HHOOK hhook
Definition: win.c:62
static void verify_window_info(const char *hook, HWND hwnd, const WINDOWINFO *info)
Definition: win.c:944
static HWND hwndMessage
Definition: win.c:60
#define GW_OWNER
Definition: winuser.h:766
#define HCBT_MINMAX
Definition: winuser.h:56
#define GW_HWNDFIRST
Definition: winuser.h:764
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define GW_HWNDLAST
Definition: winuser.h:765
#define GA_ROOT
Definition: winuser.h:2789
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
struct tagWINDOWINFO WINDOWINFO
#define HCBT_ACTIVATE
Definition: winuser.h:60
#define GA_ROOTOWNER
Definition: winuser.h:2790
#define HCBT_DESTROYWND
Definition: winuser.h:59
#define GA_PARENT
Definition: winuser.h:2788
#define HCBT_CREATEWND
Definition: winuser.h:58
#define GW_HWNDNEXT
Definition: winuser.h:761
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define HWND_TOP
Definition: winuser.h:1207
#define HCBT_SETFOCUS
Definition: winuser.h:64
#define HCBT_MOVESIZE
Definition: winuser.h:55
HWND WINAPI GetParent(_In_ HWND)
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define GW_HWNDPREV
Definition: winuser.h:762
#define GWL_STYLE
Definition: winuser.h:852
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)

Referenced by START_TEST().

◆ check_active_state_()

static void check_active_state_ ( const char file,
int  line,
HWND  active,
HWND  foreground,
HWND  focus 
)
static

Definition at line 160 of file win.c.

162{
163 ok_(file, line)(active == GetActiveWindow(), "GetActiveWindow() = %p\n", GetActiveWindow());
164 /* only check foreground if it belongs to the current thread */
165 /* foreground can be moved to a different app pretty much at any time */
166 if (foreground && GetForegroundWindow() &&
169 ok_(file, line)(foreground == GetForegroundWindow(), "GetForegroundWindow() = %p\n", GetForegroundWindow());
170 ok_(file, line)(focus == GetFocus(), "GetFocus() = %p\n", GetFocus());
171}
#define ok_(x1, x2)
Definition: atltest.h:61
#define disable_success_count
Definition: test.h:184
Definition: fci.c:127
Definition: parser.c:49
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
HWND WINAPI GetFocus(void)
Definition: window.c:1893
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:138
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392

◆ check_dialog_style()

static void check_dialog_style ( DWORD  style_in,
DWORD  ex_style_in,
DWORD  style_out,
DWORD  ex_style_out 
)
static

Definition at line 4470 of file win.c.

4471{
4472 struct
4473 {
4474 DLGTEMPLATE dt;
4475 WORD menu_name;
4476 WORD class_id;
4477 WORD class_atom;
4478 WCHAR caption[1];
4479 } dlg_data;
4480 DWORD style, ex_style;
4481 HWND hwnd, grand_parent = 0, parent = 0;
4482 struct dialog_param param;
4483 LRESULT id, ret;
4484
4485 if (style_in & WS_CHILD)
4486 {
4488 0, 0, 0, 0, NULL, NULL, NULL, NULL);
4489 ok(grand_parent != 0, "grand_parent creation failed\n");
4490 }
4491
4492 parent = CreateWindowExA(0, "static", NULL, style_in,
4493 0, 0, 0, 0, grand_parent, NULL, NULL, NULL);
4494 ok(parent != 0, "parent creation failed, style %#x\n", style_in);
4495
4496 dlg_data.dt.style = style_in;
4497 dlg_data.dt.dwExtendedStyle = ex_style_in;
4498 dlg_data.dt.cdit = 0;
4499 dlg_data.dt.x = 0;
4500 dlg_data.dt.y = 0;
4501 dlg_data.dt.cx = 100;
4502 dlg_data.dt.cy = 100;
4503 dlg_data.menu_name = 0;
4504 dlg_data.class_id = 0;
4505 dlg_data.class_atom = 0;
4506 dlg_data.caption[0] = 0;
4507
4509 ok(hwnd != 0, "dialog creation failed, style %#x, exstyle %#x\n", style_in, ex_style_in);
4510
4511 id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
4512 ok(id == MAKELONG(IDOK,DC_HASDEFID), "expected (IDOK,DC_HASDEFID), got %08lx\n", id);
4513 ret = DefDlgProcA(hwnd, DM_SETDEFID, 0x1111, 0);
4514 ok(ret, "DefDlgProc(DM_SETDEFID) failed\n");
4515 id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
4516 ok(id == MAKELONG(0x1111,DC_HASDEFID), "expected (0x1111,DC_HASDEFID), got %08lx\n", id);
4517
4518 flush_events( TRUE );
4519
4521 ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
4522 ok(style == (style_out | DS_3DLOOK), "got %#x\n", style);
4523 ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style);
4524
4525 ok(IsWindowEnabled(parent), "wrong parent state (dialog style %#x)\n", style_in);
4526
4527 /* try setting the styles explicitly */
4528 SetWindowLongA(hwnd, GWL_EXSTYLE, ex_style_in);
4530 ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
4531 ok(style == (style_out | DS_3DLOOK), "got %#x\n", style);
4532 /* WS_EX_WINDOWEDGE can't always be changed */
4533 if (ex_style_in & WS_EX_DLGMODALFRAME)
4534 ex_style_out = ex_style_in | WS_EX_WINDOWEDGE;
4535 else if ((style & (WS_DLGFRAME | WS_THICKFRAME)) && !(ex_style_in & WS_EX_STATICEDGE))
4536 ex_style_out = ex_style_in | WS_EX_WINDOWEDGE;
4537 else
4538 ex_style_out = ex_style_in & ~WS_EX_WINDOWEDGE;
4539 ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style);
4540
4541 SetWindowLongA(hwnd, GWL_STYLE, style_in);
4543 ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
4544 /* WS_CLIPSIBLINGS can't be reset on top-level windows */
4545 if ((style_in & (WS_CHILD | WS_POPUP)) == WS_CHILD) style_out = style_in;
4546 else style_out = style_in | WS_CLIPSIBLINGS;
4547 ok(style == style_out, "expected style %#x, got %#x\n", style_out, style);
4548 /* WS_EX_WINDOWEDGE can't always be changed */
4549 if (ex_style_in & WS_EX_DLGMODALFRAME)
4550 ex_style_out = ex_style_in | WS_EX_WINDOWEDGE;
4551 else if ((style & (WS_DLGFRAME | WS_THICKFRAME)) && !(ex_style_in & WS_EX_STATICEDGE))
4552 ex_style_out = ex_style_in | WS_EX_WINDOWEDGE;
4553 else
4554 ex_style_out = ex_style_in & ~WS_EX_WINDOWEDGE;
4555 /* FIXME: Remove the condition below once Wine is fixed */
4556 todo_wine_if (ex_style != ex_style_out)
4557 ok(ex_style == ex_style_out, "expected ex_style %#x, got %#x\n", ex_style_out, ex_style);
4558
4560
4561 param.parent = parent;
4562 param.grand_parent = grand_parent;
4563 param.dlg_data = &dlg_data.dt;
4565
4566 ok(IsWindowEnabled(parent), "wrong parent state (dialog style %#x)\n", style_in);
4567 if (grand_parent)
4568 ok(IsWindowEnabled(grand_parent), "wrong grand parent state (dialog style %#x)\n", style_in);
4569
4572}
static void flush_events(void)
Definition: SystemMenu.c:167
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
r parent
Definition: btrfs.c:3010
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLfloat param
Definition: glext.h:5796
GLuint id
Definition: glext.h:5910
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_THICKFRAME
Definition: pedump.c:630
WORD cdit
Definition: winuser.h:3061
short y
Definition: winuser.h:3063
short cy
Definition: winuser.h:3065
DWORD style
Definition: winuser.h:3059
DWORD dwExtendedStyle
Definition: winuser.h:3060
short x
Definition: winuser.h:3062
short cx
Definition: winuser.h:3064
DLGTEMPLATE * dlg_data
Definition: win.c:4384
HWND grand_parent
Definition: win.c:4383
#define MAKELONG(a, b)
Definition: typedefs.h:249
static INT_PTR WINAPI empty_dlg_proc2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: win.c:4387
static INT_PTR WINAPI empty_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: win.c:4338
#define WS_EX_STATICEDGE
Definition: winuser.h:403
#define DM_SETDEFID
Definition: winuser.h:2099
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define DC_HASDEFID
Definition: winuser.h:2609
#define DS_3DLOOK
Definition: winuser.h:367
LRESULT WINAPI DefDlgProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDOK
Definition: winuser.h:830
HWND WINAPI CreateDialogIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
INT_PTR WINAPI DialogBoxIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define DM_GETDEFID
Definition: winuser.h:2098
#define GWL_EXSTYLE
Definition: winuser.h:851
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by test_dialog_styles().

◆ check_error()

static int check_error ( DWORD  actual,
DWORD  expected 
)
static

Definition at line 6298 of file win.c.

6299{
6300 static int sets_last_error = -1;
6301 if (sets_last_error == -1)
6302 sets_last_error = (actual != 0xdeadbeef);
6303 return (!sets_last_error && (actual == 0xdeadbeef)) || (actual == expected);
6304}
BOOL expected
Definition: store.c:2063

◆ check_parents()

static void check_parents ( HWND  hwnd,
HWND  ga_parent,
HWND  gwl_parent,
HWND  get_parent,
HWND  gw_owner,
HWND  ga_root,
HWND  ga_root_owner 
)
static

Definition at line 118 of file win.c.

120{
121 HWND res;
122
123 if (pGetAncestor)
124 {
125 res = pGetAncestor( hwnd, GA_PARENT );
126 ok( res == ga_parent, "Wrong result for GA_PARENT %p expected %p\n", res, ga_parent );
127 }
129 ok( res == gwl_parent, "Wrong result for GWL_HWNDPARENT %p expected %p\n", res, gwl_parent );
130 res = GetParent( hwnd );
131 ok( res == get_parent, "Wrong result for GetParent %p expected %p\n", res, get_parent );
133 ok( res == gw_owner, "Wrong result for GW_OWNER %p expected %p\n", res, gw_owner );
134 if (pGetAncestor)
135 {
136 res = pGetAncestor( hwnd, GA_ROOT );
137 ok( res == ga_root, "Wrong result for GA_ROOT %p expected %p\n", res, ga_root );
138 res = pGetAncestor( hwnd, GA_ROOTOWNER );
139 ok( res == ga_root_owner, "Wrong result for GA_ROOTOWNER %p expected %p\n", res, ga_root_owner );
140 }
141}
#define GetWindowLongPtrA
Definition: winuser.h:4828
#define GWLP_HWNDPARENT
Definition: winuser.h:858

Referenced by parent_dlg_proc(), test_dialog_parent(), test_parent_owner(), and test_SetParent().

◆ check_style_wnd_proc()

static LRESULT WINAPI check_style_wnd_proc ( HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 6349 of file win.c.

6350{
6352 const STYLESTRUCT *got = (STYLESTRUCT *)lParam;
6353
6354 if (message == WM_STYLECHANGING && wParam == GWL_STYLE)
6355 {
6356 ok(got->styleOld == expected[0].styleOld, "expected old style %#x, got %#x\n",
6357 expected[0].styleOld, got->styleOld);
6358 ok(got->styleNew == expected[0].styleNew, "expected new style %#x, got %#x\n",
6359 expected[0].styleNew, got->styleNew);
6360 }
6361 else if (message == WM_STYLECHANGED && wParam == GWL_STYLE)
6362 {
6363 ok(got->styleOld == expected[1].styleOld, "expected old style %#x, got %#x\n",
6364 expected[1].styleOld, got->styleOld);
6365 ok(got->styleNew == expected[1].styleNew, "expected new style %#x, got %#x\n",
6366 expected[1].styleNew, got->styleNew);
6367 }
6368
6370}
Definition: tftpd.h:60
DWORD styleNew
Definition: winuser.h:3693
DWORD styleOld
Definition: winuser.h:3692
#define GWLP_USERDATA
Definition: treelist.c:63

Referenced by test_set_window_style().

◆ check_window_style()

static void check_window_style ( DWORD  dwStyleIn,
DWORD  dwExStyleIn,
DWORD  dwStyleOut,
DWORD  dwExStyleOut 
)
static

Definition at line 4206 of file win.c.

4207{
4208 DWORD dwActualStyle;
4209 DWORD dwActualExStyle;
4211 HWND hwnd;
4213
4214 ss.styleNew = dwStyleIn;
4215 ss.styleOld = dwExStyleIn;
4216
4217 if (dwStyleIn & WS_CHILD)
4218 {
4220 WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
4221 }
4222
4224 dwStyleIn, 0, 0, 0, 0, hwndParent, NULL, NULL, &ss);
4225 assert(hwnd);
4226
4227 flush_events( TRUE );
4228
4229 dwActualStyle = GetWindowLongA(hwnd, GWL_STYLE);
4230 dwActualExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
4231 ok(dwActualStyle == dwStyleOut, "expected style %#x, got %#x\n", dwStyleOut, dwActualStyle);
4232 ok(dwActualExStyle == dwExStyleOut, "expected ex_style %#x, got %#x\n", dwExStyleOut, dwActualExStyle);
4233
4234 /* try setting the styles explicitly */
4235 SetWindowLongA( hwnd, GWL_EXSTYLE, dwExStyleIn );
4236 dwActualStyle = GetWindowLongA(hwnd, GWL_STYLE);
4237 dwActualExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
4238 /* WS_EX_WINDOWEDGE can't always be changed */
4239 if (dwExStyleIn & WS_EX_DLGMODALFRAME)
4240 dwExStyleOut = dwExStyleIn | WS_EX_WINDOWEDGE;
4241 else if ((dwActualStyle & (WS_DLGFRAME | WS_THICKFRAME)) && !(dwExStyleIn & WS_EX_STATICEDGE))
4242 dwExStyleOut = dwExStyleIn | WS_EX_WINDOWEDGE;
4243 else
4244 dwExStyleOut = dwExStyleIn & ~WS_EX_WINDOWEDGE;
4245 ok(dwActualStyle == dwStyleOut, "expected style %#x, got %#x\n", dwStyleOut, dwActualStyle);
4246 ok(dwActualExStyle == dwExStyleOut, "expected ex_style %#x, got %#x\n", dwExStyleOut, dwActualExStyle);
4247
4248 SetWindowLongA( hwnd, GWL_STYLE, dwStyleIn );
4249 dwActualStyle = GetWindowLongA(hwnd, GWL_STYLE);
4250 dwActualExStyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
4251 /* WS_CLIPSIBLINGS can't be reset on top-level windows */
4252 if ((dwStyleIn & (WS_CHILD|WS_POPUP)) == WS_CHILD) dwStyleOut = dwStyleIn;
4253 else dwStyleOut = dwStyleIn | WS_CLIPSIBLINGS;
4254 /* WS_EX_WINDOWEDGE can't always be changed */
4255 if (dwExStyleIn & WS_EX_DLGMODALFRAME)
4256 dwExStyleOut = dwExStyleIn | WS_EX_WINDOWEDGE;
4257 else if ((dwActualStyle & (WS_DLGFRAME | WS_THICKFRAME)) && !(dwExStyleIn & WS_EX_STATICEDGE))
4258 dwExStyleOut = dwExStyleIn | WS_EX_WINDOWEDGE;
4259 else
4260 dwExStyleOut = dwExStyleIn & ~WS_EX_WINDOWEDGE;
4261 ok(dwActualStyle == dwStyleOut, "expected style %#x, got %#x\n", dwStyleOut, dwActualStyle);
4262 /* FIXME: Remove the condition below once Wine is fixed */
4263 todo_wine_if (dwActualExStyle != dwExStyleOut)
4264 ok(dwActualExStyle == dwExStyleOut, "expected ex_style %#x, got %#x\n", dwExStyleOut, dwActualExStyle);
4265
4268}
static HWND hwndParent
Definition: cryptui.c:300
#define ss
Definition: i386-dis.c:441
static ATOM atomStyleCheckClass
Definition: win.c:4184
#define MAKEINTATOM(i)
Definition: winbase.h:1463

Referenced by test_window_styles().

◆ check_wnd_state_()

static void check_wnd_state_ ( const char file,
int  line,
HWND  active,
HWND  foreground,
HWND  focus,
HWND  capture 
)
static

Definition at line 144 of file win.c.

146{
147 ok_(file, line)(active == GetActiveWindow(), "GetActiveWindow() = %p\n", GetActiveWindow());
148 /* only check foreground if it belongs to the current thread */
149 /* foreground can be moved to a different app pretty much at any time */
150 if (foreground && GetForegroundWindow() &&
153 ok_(file, line)(foreground == GetForegroundWindow(), "GetForegroundWindow() = %p\n", GetForegroundWindow());
154 ok_(file, line)(focus == GetFocus(), "GetFocus() = %p\n", GetFocus());
155 ok_(file, line)(capture == GetCapture(), "GetCapture() = %p\n", GetCapture());
156}
HWND WINAPI GetCapture(void)
Definition: message.c:2881

◆ check_z_order_debug()

static void check_z_order_debug ( HWND  hwnd,
HWND  next,
HWND  prev,
HWND  owner,
BOOL  topmost,
const char file,
int  line 
)
static

Definition at line 2795 of file win.c.

2797{
2798 HWND test;
2799 DWORD ex_style;
2800
2802 /* skip foreign windows */
2803 while (test && test != next &&
2807 {
2808 /*trace("skipping next %p (%p)\n", test, UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)));*/
2810 }
2811 ok_(file, line)(next == test, "%p: expected next %p, got %p\n", hwnd, next, test);
2812
2814 /* skip foreign windows */
2815 while (test && test != prev &&
2819 {
2820 /*trace("skipping prev %p (%p)\n", test, UlongToHandle(GetWindowLongPtr(test, GWLP_HINSTANCE)));*/
2822 }
2823 ok_(file, line)(prev == test, "%p: expected prev %p, got %p\n", hwnd, prev, test);
2824
2826 ok_(file, line)(owner == test, "%p: expected owner %p, got %p\n", hwnd, owner, test);
2827
2828 ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
2829 ok_(file, line)(!(ex_style & WS_EX_TOPMOST) == !topmost, "%p: expected %stopmost\n",
2830 hwnd, topmost ? "" : "NOT ");
2831}
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define test
Definition: rosglue.h:37
static DWORD our_pid
Definition: win.c:67
#define GWLP_HINSTANCE
Definition: winuser.h:856

◆ create_tool_window()

static HWND create_tool_window ( LONG  style,
HWND  parent 
)
static

Definition at line 201 of file win.c.

202{
203 HWND ret = CreateWindowExA(0, "ToolWindowClass", "Tool window 1", style,
204 0, 0, 100, 100, parent, 0, 0, NULL );
205 ok( ret != 0, "Creation failed\n" );
206 return ret;
207}

Referenced by test_parent_owner(), and test_SetWindowPos().

◆ create_window_thread()

static DWORD WINAPI create_window_thread ( void param)
static

Definition at line 3146 of file win.c.

3147{
3149 DWORD res;
3150 BOOL ret;
3151
3152 p->window = CreateWindowA("static", NULL, WS_POPUP | WS_VISIBLE, 0, 0, 0, 0, 0, 0, 0, 0);
3153
3154 ret = SetEvent(p->window_created);
3155 ok(ret, "SetEvent failed, last error %#x.\n", GetLastError());
3156
3157 res = WaitForSingleObject(p->test_finished, INFINITE);
3158 ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError());
3159
3160 DestroyWindow(p->window);
3161 return 0;
3162}
#define INFINITE
Definition: serial.h:102
unsigned int BOOL
Definition: ntddk_ex.h:94
GLfloat GLfloat p
Definition: glext.h:8902
#define WS_VISIBLE
Definition: pedump.c:620
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
#define WAIT_OBJECT_0
Definition: winbase.h:406
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315

Referenced by test_SetForegroundWindow().

◆ create_window_tree()

static void create_window_tree ( HWND  parent,
HWND window,
int  size 
)
static

Definition at line 8088 of file win.c.

8089{
8090 static const DWORD style[] = { 0, WS_VISIBLE, WS_DISABLED, WS_VISIBLE | WS_DISABLED };
8091 int i, pos;
8092
8093 memset(window, 0, size * sizeof(window[0]));
8094
8095 pos = 0;
8096 for (i = 0; i < sizeof(style)/sizeof(style[0]); i++)
8097 {
8098 assert(pos < size);
8099 window[pos] = CreateWindowExA(0, "my_window", NULL, style[i] | WS_CHILD,
8100 0, 0, 100, 100, parent, 0, 0, NULL);
8101 ok(window[pos] != 0, "CreateWindowEx failed\n");
8102 pos++;
8103 assert(pos < size);
8105 0, 0, 100, 100, parent, 0, 0, NULL);
8106 ok(window[pos] != 0, "CreateWindowEx failed\n");
8107 pos++;
8108
8109 assert(pos < size);
8110 window[pos] = CreateWindowExA(0, "my_httrasparent", NULL, style[i] | WS_CHILD,
8111 0, 0, 100, 100, parent, 0, 0, NULL);
8112 ok(window[pos] != 0, "CreateWindowEx failed\n");
8113 pos++;
8114 assert(pos < size);
8115 window[pos] = CreateWindowExA(WS_EX_TRANSPARENT, "my_httrasparent", NULL, style[i] | WS_CHILD,
8116 0, 0, 100, 100, parent, 0, 0, NULL);
8117 ok(window[pos] != 0, "CreateWindowEx failed\n");
8118 pos++;
8119
8120 assert(pos < size);
8121 window[pos] = CreateWindowExA(0, "my_button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
8122 0, 0, 100, 100, parent, 0, 0, NULL);
8123 ok(window[pos] != 0, "CreateWindowEx failed\n");
8124 pos++;
8125 assert(pos < size);
8127 0, 0, 100, 100, parent, 0, 0, NULL);
8128 ok(window[pos] != 0, "CreateWindowEx failed\n");
8129 pos++;
8130 assert(pos < size);
8131 window[pos] = CreateWindowExA(0, "my_button", NULL, style[i] | WS_CHILD | BS_PUSHBUTTON,
8132 0, 0, 100, 100, parent, 0, 0, NULL);
8133 ok(window[pos] != 0, "CreateWindowEx failed\n");
8134 pos++;
8135 assert(pos < size);
8137 0, 0, 100, 100, parent, 0, 0, NULL);
8138 ok(window[pos] != 0, "CreateWindowEx failed\n");
8139 pos++;
8140
8141 assert(pos < size);
8142 window[pos] = CreateWindowExA(0, "Button", NULL, style[i] | WS_CHILD | BS_GROUPBOX,
8143 0, 0, 100, 100, parent, 0, 0, NULL);
8144 ok(window[pos] != 0, "CreateWindowEx failed\n");
8145 pos++;
8146 assert(pos < size);
8148 0, 0, 100, 100, parent, 0, 0, NULL);
8149 ok(window[pos] != 0, "CreateWindowEx failed\n");
8150 pos++;
8151 assert(pos < size);
8153 0, 0, 100, 100, parent, 0, 0, NULL);
8154 ok(window[pos] != 0, "CreateWindowEx failed\n");
8155 pos++;
8156 assert(pos < size);
8158 0, 0, 100, 100, parent, 0, 0, NULL);
8159 ok(window[pos] != 0, "CreateWindowEx failed\n");
8160 pos++;
8161
8162 assert(pos < size);
8163 window[pos] = CreateWindowExA(0, "Static", NULL, style[i] | WS_CHILD,
8164 0, 0, 100, 100, parent, 0, 0, NULL);
8165 ok(window[pos] != 0, "CreateWindowEx failed\n");
8166 pos++;
8167 assert(pos < size);
8169 0, 0, 100, 100, parent, 0, 0, NULL);
8170 ok(window[pos] != 0, "CreateWindowEx failed\n");
8171 pos++;
8172 }
8173}
GLsizeiptr size
Definition: glext.h:5919
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
#define BS_GROUPBOX
Definition: pedump.c:658
#define WS_DISABLED
Definition: pedump.c:621
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define memset(x, y, z)
Definition: compat.h:39

Referenced by test_child_window_from_point().

◆ def_window_procA()

static LRESULT WINAPI def_window_procA ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 5664 of file win.c.

5665{
5666 return DefWindowProcA(hwnd, msg, wparam, lparam);
5667}

Referenced by test_IsWindowUnicode().

◆ def_window_procW()

static LRESULT WINAPI def_window_procW ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 5669 of file win.c.

5670{
5671 return DefWindowProcW(hwnd, msg, wparam, lparam);
5672}
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_IsWindowUnicode().

◆ destroy_dialog_owner_proc()

static LRESULT WINAPI destroy_dialog_owner_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 4735 of file win.c.

4736{
4737 if (msg == WM_ENTERIDLE) {
4740 }
4741 return DefWindowProcA( hwnd, msg, wparam, lparam );
4742}
static HWND dialog
Definition: gui.c:33
#define WM_ENTERIDLE
Definition: winuser.h:1749

Referenced by test_dialog_parent().

◆ dump_minmax_info()

static void dump_minmax_info ( const MINMAXINFO minmax)
static

Definition at line 73 of file win.c.

74{
75 trace("Reserved=%d,%d MaxSize=%d,%d MaxPos=%d,%d MinTrack=%d,%d MaxTrack=%d,%d\n",
76 minmax->ptReserved.x, minmax->ptReserved.y,
77 minmax->ptMaxSize.x, minmax->ptMaxSize.y,
78 minmax->ptMaxPosition.x, minmax->ptMaxPosition.y,
79 minmax->ptMinTrackSize.x, minmax->ptMinTrackSize.y,
80 minmax->ptMaxTrackSize.x, minmax->ptMaxTrackSize.y);
81}
POINT ptMaxPosition
Definition: winuser.h:3629
POINT ptMaxSize
Definition: winuser.h:3628
POINT ptMinTrackSize
Definition: winuser.h:3630
POINT ptReserved
Definition: winuser.h:3627
POINT ptMaxTrackSize
Definition: winuser.h:3631
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

Referenced by mdi_child_wnd_proc_1(), mdi_child_wnd_proc_2(), and test_thick_child_size_winproc().

◆ dump_region()

void dump_region ( HRGN  hrgn)

Definition at line 7695 of file msg.c.

7696{
7697 DWORD i, size;
7698 RGNDATA *data = NULL;
7699 RECT *rect;
7700
7701 if (!hrgn)
7702 {
7703 printf( "null region\n" );
7704 return;
7705 }
7706 if (!(size = GetRegionData( hrgn, 0, NULL ))) return;
7707 if (!(data = HeapAlloc( GetProcessHeap(), 0, size ))) return;
7709 printf("%d rects:", data->rdh.nCount );
7710 for (i = 0, rect = (RECT *)data->Buffer; i < data->rdh.nCount; i++, rect++)
7711 printf( " %s", wine_dbgstr_rect( rect ));
7712 printf("\n");
7713 HeapFree( GetProcessHeap(), 0, data );
7714}
static HRGN hrgn
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define printf
Definition: freeldr.h:97
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
& rect
Definition: startmenu.cpp:1413
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)

Referenced by check_update_rgn_(), test_scrolldc(), and test_scrollvalidate().

◆ DWORD()

static DWORD ( WINAPI pSetLayout)
static

◆ empty_dlg_proc()

static INT_PTR WINAPI empty_dlg_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 4338 of file win.c.

4339{
4340 return 0;
4341}

Referenced by check_dialog_style(), and test_dialog_parent().

◆ empty_dlg_proc2()

static INT_PTR WINAPI empty_dlg_proc2 ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 4387 of file win.c.

4388{
4389 if (msg == WM_INITDIALOG)
4390 {
4392 struct dialog_param *param = (struct dialog_param *)lparam;
4393 BOOL parent_is_child;
4394 HWND disabled_hwnd;
4395 LRESULT id, ret;
4396
4397 id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
4398 ok(id == MAKELONG(IDOK,DC_HASDEFID), "expected (IDOK,DC_HASDEFID), got %08lx\n", id);
4399 ret = DefDlgProcA(hwnd, DM_SETDEFID, 0x2222, 0);
4400 ok(ret, "DefDlgProc(DM_SETDEFID) failed\n");
4401 id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
4402 ok(id == MAKELONG(0x2222,DC_HASDEFID), "expected (0x2222,DC_HASDEFID), got %08lx\n", id);
4403
4405
4406 parent_is_child = (GetWindowLongA(param->parent, GWL_STYLE) & (WS_POPUP | WS_CHILD)) == WS_CHILD;
4407
4408 ok(IsWindowEnabled(hwnd), "wrong state for %p\n", hwnd);
4409 if (parent_is_child)
4410 {
4411 ok(IsWindowEnabled(param->parent), "wrong state for %08x\n", style);
4412 disabled_hwnd = param->grand_parent;
4413 }
4414 else
4415 {
4416 ok(!IsWindowEnabled(param->parent), "wrong state for %08x\n", style);
4417 disabled_hwnd = param->parent;
4418 }
4419
4420 if (param->grand_parent)
4421 {
4422 if (parent_is_child)
4423 ok(!IsWindowEnabled(param->grand_parent), "wrong state for %08x\n", style);
4424 else
4425 ok(IsWindowEnabled(param->grand_parent), "wrong state for %08x\n", style);
4426 }
4427
4428 DialogBoxIndirectParamA(GetModuleHandleA(NULL), param->dlg_data, disabled_hwnd, empty_dlg_proc3, 0);
4429 ok(IsWindowEnabled(disabled_hwnd), "wrong state for %08x\n", style);
4430
4431 ok(IsWindowEnabled(hwnd), "wrong state for %p\n", hwnd);
4432 ok(IsWindowEnabled(param->parent), "wrong state for %p\n", param->parent);
4433 if (param->grand_parent)
4434 ok(IsWindowEnabled(param->grand_parent), "wrong state for %p (%08x)\n", param->grand_parent, style);
4435
4437 ok(IsWindowEnabled(hwnd), "wrong state for %p\n", hwnd);
4438 ok(IsWindowEnabled(param->parent), "wrong state for %p\n", param->parent);
4439 if (param->grand_parent)
4440 ok(IsWindowEnabled(param->grand_parent), "wrong state for %p (%08x)\n", param->grand_parent, style);
4441
4442 param->dlg_data->style |= WS_CHILD;
4444 ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style);
4445
4446 param->dlg_data->style |= DS_CONTROL;
4448 ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style);
4449
4450 param->dlg_data->dwExtendedStyle |= WS_EX_CONTROLPARENT;
4453 param->dlg_data->style &= ~DS_CONTROL;
4455 ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style);
4456
4459 ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style);
4460
4461 param->dlg_data->style |= DS_CONTROL;
4463 ok(IsWindowEnabled(hwnd), "wrong state for %p (%08x)\n", hwnd, style);
4464
4465 EndDialog(hwnd, 0);
4466 }
4467 return 0;
4468}
static LRESULT expected_id
Definition: win.c:4343
static INT_PTR WINAPI empty_dlg_proc3(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: win.c:4345
#define WS_EX_CONTROLPARENT
Definition: winuser.h:387
#define WM_INITDIALOG
Definition: winuser.h:1739
#define DS_CONTROL
Definition: winuser.h:372
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by check_dialog_style().

◆ empty_dlg_proc3()

static INT_PTR WINAPI empty_dlg_proc3 ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 4345 of file win.c.

4346{
4347 if (msg == WM_INITDIALOG)
4348 {
4350 LRESULT id, ret;
4351
4352 id = DefDlgProcA(parent, DM_GETDEFID, 0, 0);
4353 if (!id || root_dialog(hwnd) == hwnd)
4354 parent = 0;
4355
4356 id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
4357 if (!parent)
4358 ok(id == MAKELONG(IDOK,DC_HASDEFID), "expected (IDOK,DC_HASDEFID), got %08lx\n", id);
4359 else
4360 ok(id == expected_id, "expected %08lx, got %08lx\n", expected_id, id);
4361
4362 ret = DefDlgProcA(hwnd, DM_SETDEFID, 0x3333, 0);
4363 ok(ret, "DefDlgProc(DM_SETDEFID) failed\n");
4364 id = DefDlgProcA(hwnd, DM_GETDEFID, 0, 0);
4365 ok(id == MAKELONG(0x3333,DC_HASDEFID), "expected (0x3333,DC_HASDEFID), got %08lx\n", id);
4366
4367 if (parent)
4368 {
4369 id = DefDlgProcA(parent, DM_GETDEFID, 0, 0);
4370 ok(id == MAKELONG(0x3333,DC_HASDEFID), "expected (0x3333,DC_HASDEFID), got %08lx\n", id);
4371
4373 }
4374
4375 EndDialog(hwnd, 0);
4376 }
4377
4378 return 0;
4379}
static HWND root_dialog(HWND hwnd)
Definition: win.c:4318

Referenced by empty_dlg_proc2().

◆ enum_proc()

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

Definition at line 671 of file win.c.

672{
673 (*(LPINT)lParam)++;
674 if (*(LPINT)lParam > 2) return FALSE;
675 return TRUE;
676}
int * LPINT
Definition: windef.h:178

Referenced by enum_thread().

◆ enum_thread()

static DWORD CALLBACK enum_thread ( void arg)
static

Definition at line 677 of file win.c.

678{
679 INT count;
680 HWND hwnd[3];
681 BOOL ret;
682 MSG msg;
683
684 if (pGetGUIThreadInfo)
685 {
687 info.cbSize = sizeof(info);
688 ret = pGetGUIThreadInfo( GetCurrentThreadId(), &info );
689 ok( ret || broken(!ret), /* win9x */
690 "GetGUIThreadInfo failed without message queue\n" );
691 SetLastError( 0xdeadbeef );
692 info.cbSize = sizeof(info) + 1;
693 ret = pGetGUIThreadInfo( GetCurrentThreadId(), &info );
694 ok( !ret, "GetGUIThreadInfo succeeded with wrong size\n" );
696 broken(GetLastError() == 0xdeadbeef), /* win9x */
697 "wrong error %u\n", GetLastError() );
698 }
699
700 PeekMessageA( &msg, 0, 0, 0, PM_NOREMOVE ); /* make sure we have a message queue */
701
702 count = 0;
704 ok( ret, "EnumThreadWindows should have returned TRUE\n" );
705 ok( count == 0, "count should be 0 got %d\n", count );
706
707 hwnd[0] = CreateWindowExA(0, "ToolWindowClass", "Tool window 1", WS_POPUP,
708 0, 0, 100, 100, 0, 0, 0, NULL );
709 count = 0;
711 ok( ret, "EnumThreadWindows should have returned TRUE\n" );
712 if (count != 2) /* Vista gives us two windows for the price of one */
713 {
714 ok( count == 1, "count should be 1 got %d\n", count );
715 hwnd[2] = CreateWindowExA(0, "ToolWindowClass", "Tool window 2", WS_POPUP,
716 0, 0, 100, 100, 0, 0, 0, NULL );
717 }
718 else hwnd[2] = 0;
719
720 hwnd[1] = CreateWindowExA(0, "ToolWindowClass", "Tool window 3", WS_POPUP,
721 0, 0, 100, 100, 0, 0, 0, NULL );
722 count = 0;
724 ok( !ret, "EnumThreadWindows should have returned FALSE\n" );
725 ok( count == 3, "count should be 3 got %d\n", count );
726
727 if (hwnd[2]) DestroyWindow(hwnd[2]);
730 return 0;
731}
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
GLuint GLuint GLsizei count
Definition: gl.h:1545
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT
Definition: typedefs.h:58
static BOOL CALLBACK enum_proc(HWND hwnd, LPARAM lParam)
Definition: win.c:671
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
BOOL WINAPI EnumThreadWindows(_In_ DWORD, _In_ WNDENUMPROC, _In_ LPARAM)
#define PM_NOREMOVE
Definition: winuser.h:1195

Referenced by test_enum_thread_windows().

◆ EnumChildProc()

static BOOL CALLBACK EnumChildProc ( HWND  hwndChild,
LPARAM  lParam 
)
static

Definition at line 185 of file win.c.

186{
187 (*(LPINT)lParam)++;
188 trace("EnumChildProc on %p\n", hwndChild);
189 if (*(LPINT)lParam > 1) return FALSE;
190 return TRUE;
191}

Referenced by test_parent_owner().

◆ EnumChildProc1()

static BOOL CALLBACK EnumChildProc1 ( HWND  hwndChild,
LPARAM  lParam 
)
static

Definition at line 194 of file win.c.

195{
196 trace("EnumChildProc1 on %p\n", hwndChild);
197 if ((HWND)lParam == hwndChild) return FALSE;
198 return TRUE;
199}

Referenced by test_parent_owner().

◆ FixedAdjustWindowRectEx()

static void FixedAdjustWindowRectEx ( RECT rc,
LONG  style,
BOOL  menu,
LONG  exstyle 
)
static

Definition at line 994 of file win.c.

995{
996 AdjustWindowRectEx(rc, style, menu, exstyle);
997 /* AdjustWindowRectEx does not include scroll bars */
998 if (style & WS_VSCROLL)
999 {
1000 if(exstyle & WS_EX_LEFTSCROLLBAR)
1002 else
1004 }
1005 if (style & WS_HSCROLL)
1007}
#define WS_VSCROLL
Definition: pedump.c:627
#define WS_HSCROLL
Definition: pedump.c:628
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG left
Definition: windef.h:306
#define SM_CXVSCROLL
Definition: winuser.h:961
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
#define SM_CYHSCROLL
Definition: winuser.h:962
#define WS_EX_LEFTSCROLLBAR
Definition: winuser.h:392
int WINAPI GetSystemMetrics(_In_ int)

Referenced by test_nonclient_area().

◆ flush_events()

static void flush_events ( BOOL  remove_messages)
static

Definition at line 84 of file win.c.

85{
86 MSG msg;
87 int diff = 200;
88 int min_timeout = 100;
89 DWORD time = GetTickCount() + diff;
90
91 while (diff > 0)
92 {
93 if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
94 if (remove_messages)
95 while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
96 diff = time - GetTickCount();
97 min_timeout = 50;
98 }
99}
#define WAIT_TIMEOUT
Definition: dderror.h:14
DWORD WINAPI GetTickCount(VOID)
Definition: time.c:455
__u16 time
Definition: mkdosfs.c:8
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
#define QS_ALLINPUT
Definition: winuser.h:903
DWORD WINAPI MsgWaitForMultipleObjects(_In_ DWORD nCount, _In_reads_opt_(nCount) CONST HANDLE *pHandles, _In_ BOOL fWaitAll, _In_ DWORD dwMilliseconds, _In_ DWORD dwWakeMask)
#define PM_REMOVE
Definition: winuser.h:1196

◆ fullscreen_wnd_proc()

static LRESULT CALLBACK fullscreen_wnd_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 7340 of file win.c.

7341{
7342 switch (msg)
7343 {
7344 case WM_NCCREATE:
7345 {
7347 ok(cs->x == mi.rcMonitor.left && cs->y == mi.rcMonitor.top &&
7348 cs->cx == mi.rcMonitor.right && cs->cy == mi.rcMonitor.bottom,
7349 "expected %s, got (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(&mi.rcMonitor),
7350 cs->x, cs->y, cs->cx, cs->cy);
7351 break;
7352 }
7353 case WM_GETMINMAXINFO:
7354 {
7355 MINMAXINFO *minmax = (MINMAXINFO *)lp;
7356 ok(minmax->ptMaxPosition.x <= mi.rcMonitor.left, "%d <= %d\n", minmax->ptMaxPosition.x, mi.rcMonitor.left);
7357 ok(minmax->ptMaxPosition.y <= mi.rcMonitor.top, "%d <= %d\n", minmax->ptMaxPosition.y, mi.rcMonitor.top);
7358 ok(minmax->ptMaxSize.x >= mi.rcMonitor.right, "%d >= %d\n", minmax->ptMaxSize.x, mi.rcMonitor.right);
7359 ok(minmax->ptMaxSize.y >= mi.rcMonitor.bottom, "%d >= %d\n", minmax->ptMaxSize.y, mi.rcMonitor.bottom);
7360 break;
7361 }
7362 }
7363 return DefWindowProcA(hwnd, msg, wp, lp);
7364}
#define cs
Definition: i386-dis.c:442
RECT rcMonitor
Definition: winuser.h:3785
LONG top
Definition: windef.h:307
static MONITORINFO mi
Definition: win.c:7338
#define WM_NCCREATE
Definition: winuser.h:1683
#define WM_GETMINMAXINFO
Definition: winuser.h:1640

Referenced by test_fullscreen().

◆ get_window_attributes()

static void get_window_attributes ( HWND  hwnd,
struct window_attributes attrs 
)
static

Definition at line 8181 of file win.c.

8182{
8183 DWORD style, ex_style, hittest;
8184
8186 ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
8187 attrs->class_name[0] = 0;
8188 GetClassNameA(hwnd, attrs->class_name, sizeof(attrs->class_name));
8189 hittest = SendMessageA(hwnd, WM_NCHITTEST, 0, 0);
8190
8191 attrs->is_visible = (style & WS_VISIBLE) != 0;
8192 attrs->is_enabled = (style & WS_DISABLED) == 0;
8193 attrs->is_groupbox = !lstrcmpiA(attrs->class_name, "Button") && (style & BS_TYPEMASK) == BS_GROUPBOX;
8194 attrs->is_httransparent = hittest == HTTRANSPARENT;
8195 attrs->is_extransparent = (ex_style & WS_EX_TRANSPARENT) != 0;
8196}
int WINAPI lstrcmpiA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4223
BOOL is_groupbox
Definition: win.c:8178
BOOL is_visible
Definition: win.c:8178
char class_name[128]
Definition: win.c:8177
BOOL is_httransparent
Definition: win.c:8178
BOOL is_extransparent
Definition: win.c:8178
BOOL is_enabled
Definition: win.c:8178
int WINAPI GetClassNameA(_In_ HWND hWnd, _Out_writes_to_(nMaxCount, return) LPSTR lpClassName, _In_ int nMaxCount)
#define BS_TYPEMASK
Definition: winuser.h:270
#define WM_NCHITTEST
Definition: winuser.h:1686
#define HTTRANSPARENT
Definition: winuser.h:2473

Referenced by test_child_window_from_point().

◆ gettext_msg_thread()

static DWORD CALLBACK gettext_msg_thread ( LPVOID  arg)
static

Definition at line 6577 of file win.c.

6578{
6579 HWND hwnd = arg;
6580 char buf[32];
6581 INT buf_len;
6582
6583 /* test GetWindowTextA */
6584 num_gettext_msgs = 0;
6585 memset( buf, 0, sizeof(buf) );
6586 buf_len = GetWindowTextA( hwnd, buf, sizeof(buf) );
6587 ok( buf_len != 0, "expected a nonempty window text\n" );
6588 ok( !strcmp(buf, "another_caption"), "got wrong window text '%s'\n", buf );
6589 ok( num_gettext_msgs == 1, "got %u WM_GETTEXT messages\n", num_gettext_msgs );
6590
6591 return 0;
6592}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1330
static DWORD num_gettext_msgs
Definition: win.c:58
void * arg
Definition: msvc.h:10

Referenced by test_gettext().

◆ HMONITOR()

static HMONITOR ( WINAPI pMonitorFromPoint)
static

◆ HWND()

static HWND ( WINAPI pGetAncestor)
static

◆ ignore_message()

static BOOL ignore_message ( UINT  message)
static

Definition at line 173 of file win.c.

174{
175 /* these are always ignored */
176 return (message >= 0xc000 ||
177 message == WM_GETICON ||
178 message == WM_GETOBJECT ||
179 message == WM_TIMER ||
180 message == WM_SYSTIMER ||
183}
#define WM_SYSTIMER
Definition: win.c:30
#define WM_DEVICECHANGE
Definition: winuser.h:1811
#define WM_TIMECHANGE
Definition: winuser.h:1634
#define WM_TIMER
Definition: winuser.h:1742

Referenced by peek_message(), and test_mouse_input().

◆ int()

static int ( WINAPI pGetWindowRgnBox)
static

◆ main_window_procA()

static LRESULT WINAPI main_window_procA ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 749 of file win.c.

750{
751 switch (msg)
752 {
753 case WM_GETMINMAXINFO:
754 {
756 break;
757 }
759 {
760 WINDOWPOS *winpos = (WINDOWPOS *)lparam;
761 if (!(winpos->flags & SWP_NOMOVE))
762 {
763 ok(winpos->x >= -32768 && winpos->x <= 32767, "bad winpos->x %d\n", winpos->x);
764 ok(winpos->y >= -32768 && winpos->y <= 32767, "bad winpos->y %d\n", winpos->y);
765 }
766 /* Win9x does not fixup cx/xy for WM_WINDOWPOSCHANGING */
767 if (!(winpos->flags & SWP_NOSIZE) && !is_win9x)
768 {
769 ok((winpos->cx >= 0 && winpos->cx <= 32767) ||
770 winpos->cx == 32768, /* win7 doesn't truncate */
771 "bad winpos->cx %d\n", winpos->cx);
772 ok((winpos->cy >= 0 && winpos->cy <= 32767) ||
773 winpos->cy == 40000, /* win7 doesn't truncate */
774 "bad winpos->cy %d\n", winpos->cy);
775 }
776 break;
777 }
780 {
781 RECT rc1, rc2;
782 WINDOWPOS *winpos = (WINDOWPOS *)lparam;
783 ok(winpos->x >= -32768 && winpos->x <= 32767, "bad winpos->x %d\n", winpos->x);
784 ok(winpos->y >= -32768 && winpos->y <= 32767, "bad winpos->y %d\n", winpos->y);
785
786 ok((winpos->cx >= 0 && winpos->cx <= 32767) ||
787 winpos->cx == 32768, /* win7 doesn't truncate */
788 "bad winpos->cx %d\n", winpos->cx);
789 ok((winpos->cy >= 0 && winpos->cy <= 32767) ||
790 winpos->cy == 40000, /* win7 doesn't truncate */
791 "bad winpos->cy %d\n", winpos->cy);
792
793 GetWindowRect(hwnd, &rc1);
794 SetRect(&rc2, winpos->x, winpos->y, winpos->x + winpos->cx, winpos->y + winpos->cy);
795 /* note: winpos coordinates are relative to parent */
797 if (0)
798 {
799 /* Uncomment this once the test succeeds in all cases */
800 ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1),
802
805 MapWindowPoints(0, hwnd, (LPPOINT)&rc1, 2);
806 ok(EqualRect(&rc1, &rc2), "rects do not match %s / %s\n", wine_dbgstr_rect(&rc1),
808 }
809 break;
810 }
811 case WM_NCCREATE:
812 {
813 BOOL got_getminmaxinfo = GetWindowLongPtrA(hwnd, GWLP_USERDATA) == 0x20031021;
815
816 if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
817 ok(got_getminmaxinfo, "main: WM_GETMINMAXINFO should have been received before WM_NCCREATE\n");
818 else
819 ok(!got_getminmaxinfo, "main: WM_GETMINMAXINFO should NOT have been received before WM_NCCREATE\n");
820 break;
821 }
822 case WM_COMMAND:
824 {
827 }
828 break;
829 case WM_GETTEXT:
831 if (g_wm_gettext_override.enabled)
832 {
833 char *text = (char*)lparam;
834 ok(g_wm_gettext_override.buff == text, "expected buffer %p, got %p\n", g_wm_gettext_override.buff, text);
835 ok(*text == 0, "expected empty string buffer %x\n", *text);
836 return 0;
837 }
838 break;
839 case WM_SETTEXT:
841 break;
842 case WM_ACTIVATEAPP:
844 else app_deactivated = TRUE;
845 break;
846 }
847
849}
static const WCHAR rc2[]
Definition: oid.c:1216
const WCHAR * text
Definition: package.c:1799
UINT flags
Definition: winuser.h:3594
static BOOL app_activated
Definition: win.c:63
static BOOL app_deactivated
Definition: win.c:63
static BOOL test_lbuttondown_flag
Definition: win.c:57
static BOOL is_win9x
Definition: win.c:69
static DWORD num_settext_msgs
Definition: win.c:59
static struct wm_gettext_override_data g_wm_gettext_override
#define SetWindowLongPtrA
Definition: winuser.h:5345
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1661
#define SWP_NOMOVE
Definition: winuser.h:1244
#define WM_COMMAND
Definition: winuser.h:1740
#define SWP_NOSIZE
Definition: winuser.h:1245
#define WM_GETTEXT
Definition: winuser.h:1618
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define WM_SETTEXT
Definition: winuser.h:1617
#define WM_ACTIVATEAPP
Definition: winuser.h:1632
#define WM_NCCALCSIZE
Definition: winuser.h:1685
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1662
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by RegisterWindowClasses(), and test_SetWindowLong().

◆ main_window_procW()

static LRESULT WINAPI main_window_procW ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 851 of file win.c.

852{
853 switch (msg)
854 {
855 case WM_GETTEXT:
857 if (g_wm_gettext_override.enabled)
858 {
859 WCHAR *text = (WCHAR*)lparam;
860 ok(g_wm_gettext_override.buffW == text, "expected buffer %p, got %p\n", g_wm_gettext_override.buffW, text);
861 ok(*text == 0, "expected empty string buffer %x\n", *text);
862 return 0;
863 }
864 break;
865 }
866
868}

Referenced by RegisterWindowClasses().

◆ mdi_child_wnd_proc_1()

static LRESULT WINAPI mdi_child_wnd_proc_1 ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1808 of file win.c.

1809{
1810 switch (msg)
1811 {
1812 case WM_NCCREATE:
1813 case WM_CREATE:
1814 {
1816 MDICREATESTRUCTA *mdi_cs = cs->lpCreateParams;
1817
1818 ok(cs->dwExStyle & WS_EX_MDICHILD, "WS_EX_MDICHILD should be set\n");
1819 ok(mdi_cs->lParam == (LPARAM)mdi_lParam_test_message, "wrong mdi_cs->lParam\n");
1820
1821 ok(!lstrcmpA(cs->lpszClass, "MDI_child_Class_1"), "wrong class name\n");
1822 ok(!lstrcmpA(cs->lpszClass, mdi_cs->szClass), "class name does not match\n");
1823 ok(!lstrcmpA(cs->lpszName, "MDI child"), "wrong title\n");
1824 ok(!lstrcmpA(cs->lpszName, mdi_cs->szTitle), "title does not match\n");
1825 ok(cs->hInstance == mdi_cs->hOwner, "%p != %p\n", cs->hInstance, mdi_cs->hOwner);
1826
1827 /* MDICREATESTRUCT should have original values */
1828 ok(mdi_cs->style == 0 || mdi_cs->style == 0x7fffffff || mdi_cs->style == 0xffffffff || mdi_cs->style == WS_MAXIMIZE,
1829 "mdi_cs->style does not match (%08x)\n", mdi_cs->style);
1830 ok(mdi_cs->x == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->x);
1831 ok(mdi_cs->y == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->y);
1832 ok(mdi_cs->cx == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->cx);
1833 ok(mdi_cs->cy == CW_USEDEFAULT, "%d != CW_USEDEFAULT\n", mdi_cs->cy);
1834
1835 /* CREATESTRUCT should have fixed values */
1836 ok(cs->x != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->x);
1837 ok(cs->y != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->y);
1838
1839 /* cx/cy == CW_USEDEFAULT are translated to NOT zero values */
1840 ok(cs->cx != CW_USEDEFAULT && cs->cx != 0, "%d == CW_USEDEFAULT\n", cs->cx);
1841 ok(cs->cy != CW_USEDEFAULT && cs->cy != 0, "%d == CW_USEDEFAULT\n", cs->cy);
1842
1843 ok(!(cs->style & WS_POPUP), "WS_POPUP is not allowed\n");
1844
1845 if (GetWindowLongA(cs->hwndParent, GWL_STYLE) & MDIS_ALLCHILDSTYLES)
1846 {
1847 LONG style = mdi_cs->style | WS_CHILD | WS_CLIPSIBLINGS;
1848 ok(cs->style == style,
1849 "cs->style does not match (%08x)\n", cs->style);
1850 }
1851 else
1852 {
1853 LONG style = mdi_cs->style;
1854 style &= ~WS_POPUP;
1857 ok(cs->style == style,
1858 "cs->style does not match (%08x)\n", cs->style);
1859 }
1860 break;
1861 }
1862
1863 case WM_GETMINMAXINFO:
1864 {
1866 RECT rc;
1867 MINMAXINFO *minmax = (MINMAXINFO *)lparam;
1868 MINMAXINFO my_minmax;
1869 LONG style, exstyle;
1870
1872 exstyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
1873
1874 GetClientRect(client, &rc);
1875
1876 GetClientRect(client, &rc);
1877 if ((style & WS_CAPTION) == WS_CAPTION)
1878 style &= ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
1879 AdjustWindowRectEx(&rc, style, 0, exstyle);
1880 trace("MDI child: calculated max window size = (%d x %d)\n", rc.right-rc.left, rc.bottom-rc.top);
1881 dump_minmax_info( minmax );
1882
1883 ok(minmax->ptMaxSize.x == rc.right - rc.left, "default width of maximized child %d != %d\n",
1884 minmax->ptMaxSize.x, rc.right - rc.left);
1885 ok(minmax->ptMaxSize.y == rc.bottom - rc.top, "default height of maximized child %d != %d\n",
1886 minmax->ptMaxSize.y, rc.bottom - rc.top);
1887
1889
1890 trace("DefMDIChildProc returned:\n");
1891 dump_minmax_info( minmax );
1892
1893 MDI_ChildGetMinMaxInfo(client, hwnd, &my_minmax);
1894 ok(minmax->ptMaxSize.x == my_minmax.ptMaxSize.x, "default width of maximized child %d != %d\n",
1895 minmax->ptMaxSize.x, my_minmax.ptMaxSize.x);
1896 ok(minmax->ptMaxSize.y == my_minmax.ptMaxSize.y, "default height of maximized child %d != %d\n",
1897 minmax->ptMaxSize.y, my_minmax.ptMaxSize.y);
1898
1899 return 1;
1900 }
1901
1902 case WM_MDIACTIVATE:
1903 {
1904 HWND active, client = GetParent(hwnd);
1905 /*trace("%p WM_MDIACTIVATE %08x %08lx\n", hwnd, wparam, lparam);*/
1906 active = (HWND)SendMessageA(client, WM_MDIGETACTIVE, 0, 0);
1907 if (hwnd == (HWND)lparam) /* if we are being activated */
1908 ok (active == (HWND)lparam, "new active %p != active %p\n", (HWND)lparam, active);
1909 else
1910 ok (active == (HWND)wparam, "old active %p != active %p\n", (HWND)wparam, active);
1911 break;
1912 }
1913 }
1915}
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4194
#define WS_CAPTION
Definition: pedump.c:624
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_MINIMIZEBOX
Definition: pedump.c:631
static char mdi_lParam_test_message[]
Definition: win.c:1366
static void MDI_ChildGetMinMaxInfo(HWND client, HWND hwnd, MINMAXINFO *lpMinMax)
Definition: win.c:1789
static void dump_minmax_info(const MINMAXINFO *minmax)
Definition: win.c:73
LRESULT WINAPI DefMDIChildProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1608
#define WM_MDIACTIVATE
Definition: winuser.h:1814
#define MDIS_ALLCHILDSTYLES
Definition: winuser.h:253
#define WS_EX_MDICHILD
Definition: winuser.h:394
#define CW_USEDEFAULT
Definition: winuser.h:225
#define WM_MDIGETACTIVE
Definition: winuser.h:1821

Referenced by mdi_RegisterWindowClasses().

◆ mdi_child_wnd_proc_2()

static LRESULT WINAPI mdi_child_wnd_proc_2 ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1917 of file win.c.

1918{
1919 switch (msg)
1920 {
1921 case WM_NCCREATE:
1922 case WM_CREATE:
1923 {
1925
1926 trace("%s: x %d, y %d, cx %d, cy %d\n", (msg == WM_NCCREATE) ? "WM_NCCREATE" : "WM_CREATE",
1927 cs->x, cs->y, cs->cx, cs->cy);
1928
1929 ok(!(cs->dwExStyle & WS_EX_MDICHILD), "WS_EX_MDICHILD should not be set\n");
1930 ok(cs->lpCreateParams == mdi_lParam_test_message, "wrong cs->lpCreateParams\n");
1931
1932 ok(!lstrcmpA(cs->lpszClass, "MDI_child_Class_2"), "wrong class name\n");
1933 ok(!lstrcmpA(cs->lpszName, "MDI child"), "wrong title\n");
1934
1935 /* CREATESTRUCT should have fixed values */
1936 /* For some reason Win9x doesn't translate cs->x from CW_USEDEFAULT,
1937 while NT does. */
1938 /*ok(cs->x != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->x);*/
1939 ok(cs->y != CW_USEDEFAULT, "%d == CW_USEDEFAULT\n", cs->y);
1940
1941 /* cx/cy == CW_USEDEFAULT are translated to 0 */
1942 /* For some reason Win98 doesn't translate cs->cx from CW_USEDEFAULT,
1943 while Win95, Win2k, WinXP do. */
1944 /*ok(cs->cx == 0, "%d != 0\n", cs->cx);*/
1945 ok(cs->cy == 0, "%d != 0\n", cs->cy);
1946 break;
1947 }
1948
1949 case WM_GETMINMAXINFO:
1950 {
1952 RECT rc;
1953 MINMAXINFO *minmax = (MINMAXINFO *)lparam;
1954 LONG style, exstyle;
1955
1957 exstyle = GetWindowLongA(hwnd, GWL_EXSTYLE);
1958
1959 GetClientRect(parent, &rc);
1960 trace("WM_GETMINMAXINFO: parent %p client size = (%d x %d)\n", parent, rc.right, rc.bottom);
1961
1962 GetClientRect(parent, &rc);
1963 if ((style & WS_CAPTION) == WS_CAPTION)
1964 style &= ~WS_BORDER; /* WS_CAPTION = WS_DLGFRAME | WS_BORDER */
1965 AdjustWindowRectEx(&rc, style, 0, exstyle);
1966 dump_minmax_info( minmax );
1967
1968 ok(minmax->ptMaxSize.x == rc.right - rc.left, "default width of maximized child %d != %d\n",
1969 minmax->ptMaxSize.x, rc.right - rc.left);
1970 ok(minmax->ptMaxSize.y == rc.bottom - rc.top, "default height of maximized child %d != %d\n",
1971 minmax->ptMaxSize.y, rc.bottom - rc.top);
1972 break;
1973 }
1974
1976 {
1977 WINDOWPOS *winpos = (WINDOWPOS *)lparam;
1978 RECT rc1, rc2;
1979
1980 GetWindowRect(hwnd, &rc1);
1981 SetRect(&rc2, winpos->x, winpos->y, winpos->x + winpos->cx, winpos->y + winpos->cy);
1982 /* note: winpos coordinates are relative to parent */
1984 ok(EqualRect(&rc1, &rc2), "rects do not match, window=%s pos=%s\n",
1986 GetWindowRect(hwnd, &rc1);
1989 MapWindowPoints(0, hwnd, (LPPOINT)&rc1, 2);
1990 ok(EqualRect(&rc1, &rc2), "rects do not match, window=%s client=%s\n",
1992 }
1993 /* fall through */
1995 {
1996 WINDOWPOS *winpos = (WINDOWPOS *)lparam;
1997 WINDOWPOS my_winpos = *winpos;
1998
1999 trace("%s: %p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
2000 (msg == WM_WINDOWPOSCHANGING) ? "WM_WINDOWPOSCHANGING" : "WM_WINDOWPOSCHANGED",
2001 winpos->hwnd, winpos->hwndInsertAfter,
2002 winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
2003
2005
2006 ok(!memcmp(&my_winpos, winpos, sizeof(WINDOWPOS)),
2007 "DefWindowProc should not change WINDOWPOS: %p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
2008 winpos->hwnd, winpos->hwndInsertAfter,
2009 winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
2010
2011 return 1;
2012 }
2013 }
2014 return DefWindowProcA(hwnd, msg, wparam, lparam);
2015}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HWND hwnd
Definition: winuser.h:3588
HWND hwndInsertAfter
Definition: winuser.h:3589

Referenced by mdi_RegisterWindowClasses().

◆ MDI_ChildGetMinMaxInfo()

static void MDI_ChildGetMinMaxInfo ( HWND  client,
HWND  hwnd,
MINMAXINFO lpMinMax 
)
static

Definition at line 1789 of file win.c.

1790{
1791 RECT rect;
1792
1796
1797 rect.right -= rect.left;
1798 rect.bottom -= rect.top;
1799 lpMinMax->ptMaxSize.x = rect.right;
1800 lpMinMax->ptMaxSize.y = rect.bottom;
1801
1802 lpMinMax->ptMaxPosition.x = rect.left;
1803 lpMinMax->ptMaxPosition.y = rect.top;
1804
1805 trace("max rect %s\n", wine_dbgstr_rect(&rect));
1806}

Referenced by mdi_child_wnd_proc_1().

◆ mdi_main_wnd_procA()

static LRESULT WINAPI mdi_main_wnd_procA ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 2017 of file win.c.

2018{
2019 static HWND mdi_client;
2020
2021 switch (msg)
2022 {
2023 case WM_CREATE:
2024 return 1;
2025
2027 {
2028 WINDOWPOS *winpos = (WINDOWPOS *)lparam;
2029 RECT rc1, rc2;
2030
2031 GetWindowRect(hwnd, &rc1);
2032 trace("window: %s\n", wine_dbgstr_rect(&rc1));
2033 SetRect(&rc2, winpos->x, winpos->y, winpos->x + winpos->cx, winpos->y + winpos->cy);
2034 /* note: winpos coordinates are relative to parent */
2036 trace("pos: %s\n", wine_dbgstr_rect(&rc2));
2037 ok(EqualRect(&rc1, &rc2), "rects do not match\n");
2038
2039 GetWindowRect(hwnd, &rc1);
2042 MapWindowPoints(0, hwnd, (LPPOINT)&rc1, 2);
2043 ok(EqualRect(&rc1, &rc2), "rects do not match\n");
2044 }
2045 /* fall through */
2047 {
2048 WINDOWPOS *winpos = (WINDOWPOS *)lparam;
2049 WINDOWPOS my_winpos = *winpos;
2050
2051 trace("%s\n", (msg == WM_WINDOWPOSCHANGING) ? "WM_WINDOWPOSCHANGING" : "WM_WINDOWPOSCHANGED");
2052 trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
2053 winpos->hwnd, winpos->hwndInsertAfter,
2054 winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
2055
2057
2058 trace("%p after %p, x %d, y %d, cx %d, cy %d flags %08x\n",
2059 winpos->hwnd, winpos->hwndInsertAfter,
2060 winpos->x, winpos->y, winpos->cx, winpos->cy, winpos->flags);
2061
2062 ok(!memcmp(&my_winpos, winpos, sizeof(WINDOWPOS)),
2063 "DefWindowProc should not change WINDOWPOS values\n");
2064
2065 return 1;
2066 }
2067
2068 case WM_CLOSE:
2069 PostQuitMessage(0);
2070 break;
2071 }
2073}
static HWND mdi_client
Definition: msg.c:3639
LRESULT WINAPI DefFrameProcA(_In_ HWND, _In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CLOSE
Definition: winuser.h:1621
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by mdi_RegisterWindowClasses().

◆ mdi_RegisterWindowClasses()

static BOOL mdi_RegisterWindowClasses ( void  )
static

Definition at line 2075 of file win.c.

2076{
2077 WNDCLASSA cls;
2078
2079 cls.style = 0;
2081 cls.cbClsExtra = 0;
2082 cls.cbWndExtra = 0;
2083 cls.hInstance = GetModuleHandleA(0);
2084 cls.hIcon = 0;
2087 cls.lpszMenuName = NULL;
2088 cls.lpszClassName = "MDI_parent_Class";
2089 if(!RegisterClassA(&cls)) return FALSE;
2090
2092 cls.lpszClassName = "MDI_child_Class_1";
2093 if(!RegisterClassA(&cls)) return FALSE;
2094
2096 cls.lpszClassName = "MDI_child_Class_2";
2097 if(!RegisterClassA(&cls)) return FALSE;
2098
2099 return TRUE;
2100}
HBRUSH hbrBackground
Definition: winuser.h:3170
HICON hIcon
Definition: winuser.h:3168
HINSTANCE hInstance
Definition: winuser.h:3167
HCURSOR hCursor
Definition: winuser.h:3169
int cbWndExtra
Definition: winuser.h:3166
LPCSTR lpszMenuName
Definition: winuser.h:3171
LPCSTR lpszClassName
Definition: winuser.h:3172
WNDPROC lpfnWndProc
Definition: winuser.h:3164
int cbClsExtra
Definition: winuser.h:3165
static LRESULT WINAPI mdi_child_wnd_proc_2(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: win.c:1917
static LRESULT WINAPI mdi_main_wnd_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: win.c:2017
static LRESULT WINAPI mdi_child_wnd_proc_1(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: win.c:1808
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define WHITE_BRUSH
Definition: wingdi.h:902

Referenced by test_mdi().

◆ minmax_wnd_proc()

static LRESULT CALLBACK minmax_wnd_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 5793 of file win.c.

5794{
5795 MINMAXINFO *minmax;
5796
5797 if (msg != WM_GETMINMAXINFO)
5798 return DefWindowProcA(hwnd, msg, wp, lp);
5799
5800 minmax = (MINMAXINFO *)lp;
5801
5803 {
5804 minmax->ptReserved.x = 0;
5805 minmax->ptReserved.y = 0;
5806 minmax->ptMaxSize.x = 400;
5807 minmax->ptMaxSize.y = 400;
5808 minmax->ptMaxPosition.x = 300;
5809 minmax->ptMaxPosition.y = 300;
5810 minmax->ptMaxTrackSize.x = 200;
5811 minmax->ptMaxTrackSize.y = 200;
5812 minmax->ptMinTrackSize.x = 100;
5813 minmax->ptMinTrackSize.y = 100;
5814 }
5815 else
5816 DefWindowProcA(hwnd, msg, wp, lp);
5817 return 1;
5818}

Referenced by test_CreateWindow().

◆ my_httrasparent_proc()

static LRESULT WINAPI my_httrasparent_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 8077 of file win.c.

8078{
8079 if (msg == WM_NCHITTEST) return HTTRANSPARENT;
8080 return DefWindowProcA(hwnd, msg, wp, lp);
8081}

Referenced by test_child_window_from_point().

◆ my_window_proc()

static LRESULT WINAPI my_window_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 8083 of file win.c.

8084{
8085 return DefWindowProcA(hwnd, msg, wp, lp);
8086}

Referenced by test_child_window_from_point().

◆ nccalchelper()

static void nccalchelper ( HWND  hwnd,
INT  x,
INT  y,
RECT prc 
)
static

Definition at line 3921 of file win.c.

3922{
3923 RECT rc;
3924 MoveWindow( hwnd, 0, 0, x, y, 0);
3926 rc = *prc;
3928 trace("window rect is %s, nccalc rect is %s\n", wine_dbgstr_rect(&rc), wine_dbgstr_rect(prc));
3929}
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_Out_ LPRECT prc
Definition: ntgdi.h:1658
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by test_nccalcscroll().

◆ nccalcsize_proc()

static LRESULT WINAPI nccalcsize_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 2423 of file win.c.

2424{
2425 if (msg == WM_NCCALCSIZE)
2426 {
2427 RECT *rect = (RECT *)lparam;
2428 /* first time around increase the rectangle, next time decrease it */
2429 if (rect->left == 100) InflateRect( rect, 10, 10 );
2430 else InflateRect( rect, -10, -10 );
2431 return 0;
2432 }
2433 return DefWindowProcA( hwnd, msg, wparam, lparam );
2434}
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)

Referenced by test_SetWindowPos().

◆ parent_dlg_proc()

static INT_PTR WINAPI parent_dlg_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 4671 of file win.c.

4672{
4673 if (msg == WM_INITDIALOG) {
4674 struct dlg_parent_param *param = (void*)lparam;
4675 check_parents(hwnd, param->ga_parent, param->gwl_parent, param->get_parent, param->owner,
4676 param->root ? param->root : hwnd, param->ga_root_owner ? param->ga_root_owner : hwnd);
4677
4678 ok(!IsWindowEnabled(param->gwl_parent), "parent is not disabled\n");
4679 EndDialog(hwnd, 2);
4680 ok(IsWindowEnabled(param->gwl_parent), "parent is not enabled\n");
4681 }
4682
4683 return 0;
4684}
static void check_parents(HWND hwnd, HWND ga_parent, HWND gwl_parent, HWND get_parent, HWND gw_owner, HWND ga_root, HWND ga_root_owner)
Definition: win.c:118

Referenced by test_dialog_parent().

◆ parentdc_window_procA()

static LRESULT WINAPI parentdc_window_procA ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 5444 of file win.c.

5445{
5446 RECT rc;
5447 PAINTSTRUCT ps;
5448
5450
5451 switch (msg)
5452 {
5453 case WM_PAINT:
5454 GetClientRect(hwnd, &rc);
5455 t->client = rc;
5456 GetWindowRect(hwnd, &rc);
5457 trace("WM_PAINT: hwnd %p, client rect %s, window rect %s\n", hwnd,
5458 wine_dbgstr_rect(&t->client), wine_dbgstr_rect(&rc));
5459 BeginPaint(hwnd, &ps);
5460 t->paint = ps.rcPaint;
5461 GetClipBox(ps.hdc, &rc);
5462 t->clip = rc;
5463 trace("clip rect %s, paint rect %s\n", wine_dbgstr_rect(&rc),
5465 EndPaint(hwnd, &ps);
5466 return 0;
5467 }
5468 return DefWindowProcA(hwnd, msg, wparam, lparam);
5469}
int WINAPI GetClipBox(_In_ HDC, _Out_ LPRECT)
#define WM_PAINT
Definition: winuser.h:1620
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by test_csparentdc().

◆ peek_message()

static BOOL peek_message ( MSG msg)
static

Definition at line 3578 of file win.c.

3579{
3580 BOOL ret;
3581 do
3582 {
3583 ret = PeekMessageA(msg, 0, 0, 0, PM_REMOVE);
3584 } while (ret && ignore_message(msg->message));
3585 return ret;
3586}
static BOOL ignore_message(UINT message)
Definition: win.c:173

Referenced by test_keyboard_input(), test_mouse_input(), and wait_for_message().

◆ post_quit_dialog_owner_proc()

static LRESULT WINAPI post_quit_dialog_owner_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 4726 of file win.c.

4727{
4728 if (msg == WM_ENTERIDLE) {
4730 PostMessageA(dialog, WM_QUIT, 0, 0);
4731 }
4732 return DefWindowProcA( hwnd, msg, wparam, lparam );
4733}
#define WM_QUIT
Definition: winuser.h:1623
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_dialog_parent().

◆ redraw_window_procA()

static LRESULT WINAPI redraw_window_procA ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 5376 of file win.c.

5377{
5378 switch (msg)
5379 {
5380 case WM_PAINT:
5381 trace("doing WM_PAINT %d\n", WMPAINT_count);
5382 WMPAINT_count++;
5383 if (WMPAINT_count > 10 && redrawComplete == 0) {
5384 PAINTSTRUCT ps;
5385 BeginPaint(hwnd, &ps);
5386 EndPaint(hwnd, &ps);
5387 return 1;
5388 }
5389 return 0;
5390 }
5391 return DefWindowProcA(hwnd, msg, wparam, lparam);
5392}
static int WMPAINT_count
Definition: win.c:5374
static int redrawComplete
Definition: win.c:5374

Referenced by test_redrawnow().

◆ register_style_check_class()

static void register_style_check_class ( void  )
static

Definition at line 4186 of file win.c.

4187{
4188 WNDCLASSA wc =
4189 {
4190 0,
4192 0,
4193 0,
4195 NULL,
4197 (HBRUSH)(COLOR_BTNFACE+1),
4198 NULL,
4199 "WineStyleCheck",
4200 };
4201
4204}
static LRESULT WINAPI StyleCheckProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: win.c:4151
#define COLOR_BTNFACE
Definition: winuser.h:928

Referenced by test_window_styles().

◆ RegisterWindowClasses()

static BOOL RegisterWindowClasses ( void  )
static

Definition at line 897 of file win.c.

898{
899 WNDCLASSW clsW;
900 WNDCLASSA cls;
901
902 cls.style = CS_DBLCLKS;
904 cls.cbClsExtra = 0;
905 cls.cbWndExtra = 0;
907 cls.hIcon = 0;
910 cls.lpszMenuName = NULL;
911 cls.lpszClassName = "MainWindowClass";
912
913 if(!RegisterClassA(&cls)) return FALSE;
914
915 clsW.style = CS_DBLCLKS;
917 clsW.cbClsExtra = 0;
918 clsW.cbWndExtra = 0;
919 clsW.hInstance = GetModuleHandleA(0);
920 clsW.hIcon = 0;
923 clsW.lpszMenuName = NULL;
925
926 if(!RegisterClassW(&clsW)) return FALSE;
927
928 cls.style = 0;
930 cls.cbClsExtra = 0;
931 cls.cbWndExtra = 0;
933 cls.hIcon = 0;
936 cls.lpszMenuName = NULL;
937 cls.lpszClassName = "ToolWindowClass";
938
939 if(!RegisterClassA(&cls)) return FALSE;
940
941 return TRUE;
942}
LPCWSTR lpszClassName
Definition: winuser.h:3185
LPCWSTR lpszMenuName
Definition: winuser.h:3184
HBRUSH hbrBackground
Definition: winuser.h:3183
HICON hIcon
Definition: winuser.h:3181
HINSTANCE hInstance
Definition: winuser.h:3180
int cbClsExtra
Definition: winuser.h:3178
UINT style
Definition: winuser.h:3176
WNDPROC lpfnWndProc
Definition: winuser.h:3177
int cbWndExtra
Definition: winuser.h:3179
HCURSOR hCursor
Definition: winuser.h:3182
static const WCHAR mainclassW[]
Definition: win.c:895
static LRESULT WINAPI main_window_procW(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: win.c:851
static LRESULT WINAPI tool_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: win.c:870
static LRESULT WINAPI main_window_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: win.c:749
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define CS_DBLCLKS
Definition: winuser.h:651

Referenced by START_TEST().

◆ reparent_dialog_owner_proc()

static LRESULT WINAPI reparent_dialog_owner_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 4711 of file win.c.

4712{
4713 if (msg == WM_ENTERIDLE) {
4715 HWND owner = GetParent(dialog);
4716 /* EndDialog will enable owner */
4717 EnableWindow(owner, FALSE);
4718 EndDialog(dialog, 2);
4719 ok(IsWindowEnabled(owner), "owner is not enabled\n");
4720 /* ...but it won't be enabled on dialog exit */
4721 EnableWindow(owner, FALSE);
4722 }
4723 return DefWindowProcA( hwnd, msg, wparam, lparam );
4724}
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by test_dialog_parent().

◆ reparent_dlg_proc()

static INT_PTR WINAPI reparent_dlg_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 4686 of file win.c.

4687{
4688 if (msg == WM_INITDIALOG) {
4689 ok(!IsWindowEnabled(GetParent(hwnd)), "parent is not disabled\n");
4691 }
4692
4693 return 0;
4694}
HWND WINAPI SetParent(_In_ HWND, _In_opt_ HWND)

Referenced by test_dialog_parent().

◆ reparent_owned_dlg_proc()

static INT_PTR WINAPI reparent_owned_dlg_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 4696 of file win.c.

4697{
4698 if (msg == WM_INITDIALOG) {
4699 HWND new_parent = (HWND)lparam;
4700 HWND owner = GetWindow(hwnd, GW_OWNER);
4701 ok(!IsWindowEnabled(owner), "owner is not disabled\n");
4703 SetParent(hwnd, new_parent);
4704 ok(GetParent(hwnd) == new_parent, "GetParent(hwnd) = %p, expected %p\n", GetParent(hwnd), new_parent);
4705 PostMessageA(hwnd, WM_QUIT, 0, 0);
4706 }
4707
4708 return 0;
4709}

Referenced by test_dialog_parent().

◆ root_dialog()

static HWND root_dialog ( HWND  hwnd)
static

Definition at line 4318 of file win.c.

4319{
4322 {
4324
4325 /* simple detector for a window being a dialog */
4326 if (!DefDlgProcA(parent, DM_GETDEFID, 0, 0))
4327 break;
4328
4329 hwnd = parent;
4330
4332 break;
4333 }
4334
4335 return hwnd;
4336}

Referenced by empty_dlg_proc3().

◆ run_NCRedrawLoop()

static void run_NCRedrawLoop ( UINT  flags)
static

Definition at line 6970 of file win.c.

6971{
6972 HWND hwnd;
6973 MSG msg;
6974
6975 UINT loopcount = 0;
6976
6977 hwnd = CreateWindowA("TestNCRedrawClass", "MainWindow",
6978 WS_OVERLAPPEDWINDOW, 0, 0, 200, 100,
6979 NULL, NULL, 0, &flags);
6983 while (PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE))
6984 {
6985 if (msg.message == WM_PAINT) loopcount++;
6986 if (loopcount >= 100) break;
6990 }
6992 ok(loopcount < 100, "Detected infinite WM_PAINT loop (%x).\n", flags);
6994}
GLbitfield flags
Definition: glext.h:7161
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define RDW_FRAME
Definition: winuser.h:1212
BOOL WINAPI UpdateWindow(_In_ HWND)
#define RDW_INVALIDATE
Definition: winuser.h:1214

Referenced by test_NCRedraw().

◆ set_focus_on_activate_proc()

static LRESULT WINAPI set_focus_on_activate_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wp,
LPARAM  lp 
)
static

Definition at line 2960 of file win.c.

2961{
2962 if (msg == WM_ACTIVATE && LOWORD(wp) == WA_ACTIVE)
2963 {
2965 ok(child != 0, "couldn't find child window\n");
2966 SetFocus(child);
2967 ok(GetFocus() == child, "Focus should be on child %p\n", child);
2968 return 0;
2969 }
2970 return DefWindowProcA(hwnd, msg, wp, lp);
2971}
static HWND child
Definition: cursoricon.c:298
#define LOWORD(l)
Definition: pedump.c:82
#define WM_ACTIVATE
Definition: winuser.h:1612
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WA_ACTIVE
Definition: winuser.h:2623
#define GW_CHILD
Definition: winuser.h:763

Referenced by test_SetFocus().

◆ set_foreground_thread()

static DWORD WINAPI set_foreground_thread ( void params)
static

Definition at line 9020 of file win.c.

9021{
9023 MSG msg;
9024
9025 p->thread_window = CreateWindowExA(0, "static", "thread window", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
9026 0, 0, 10, 10, 0, 0, 0, NULL);
9027 SetEvent(p->command_executed);
9028
9029 while(GetMessageA(&msg, 0, 0, 0))
9030 {
9031 if (msg.message == p->msg_quit)
9032 break;
9033
9034 if (msg.message == p->msg_command)
9035 {
9036 if (msg.wParam & SET_FOREGROUND_STEAL_1)
9037 {
9038 SetForegroundWindow(p->thread_window);
9039 check_wnd_state(p->thread_window, p->thread_window, p->thread_window, 0);
9040 }
9041 if (msg.wParam & SET_FOREGROUND_INJECT)
9042 {
9043 SendNotifyMessageA(p->window1, WM_ACTIVATEAPP, 0, 0);
9044 }
9045 if (msg.wParam & SET_FOREGROUND_SET_1)
9046 {
9047 SetForegroundWindow(p->window1);
9048 check_wnd_state(0, p->window1, 0, 0);
9049 }
9050 if (msg.wParam & SET_FOREGROUND_STEAL_2)
9051 {
9052 SetForegroundWindow(p->thread_window);
9053 check_wnd_state(p->thread_window, p->thread_window, p->thread_window, 0);
9054 }
9055 if (msg.wParam & SET_FOREGROUND_SET_2)
9056 {
9057 SetForegroundWindow(p->window2);
9058 check_wnd_state(0, p->window2, 0, 0);
9059 }
9060
9061 SetEvent(p->command_executed);
9062 continue;
9063 }
9064
9067 }
9068
9069 DestroyWindow(p->thread_window);
9070 return 0;
9071}
GLenum const GLfloat * params
Definition: glext.h:5645
#define SET_FOREGROUND_SET_1
Definition: win.c:9008
#define SET_FOREGROUND_STEAL_2
Definition: win.c:9009
#define SET_FOREGROUND_SET_2
Definition: win.c:9010
#define SET_FOREGROUND_INJECT
Definition: win.c:9011
#define SET_FOREGROUND_STEAL_1
Definition: win.c:9007
BOOL WINAPI SetForegroundWindow(_In_ HWND)
BOOL WINAPI SendNotifyMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)

Referenced by test_activateapp().

◆ settext_msg_thread()

static DWORD CALLBACK settext_msg_thread ( LPVOID  arg)
static

Definition at line 6594 of file win.c.

6595{
6596 HWND hwnd = arg;
6597 BOOL success;
6598
6599 /* test SetWindowTextA */
6600 num_settext_msgs = 0;
6601 success = SetWindowTextA( hwnd, "thread_caption" );
6602 ok( success, "SetWindowTextA failed\n" );
6603 ok( num_settext_msgs == 1, "got %u WM_SETTEXT messages\n", num_settext_msgs );
6604
6605 return 0;
6606}
#define success(from, fromstr, to, tostr)
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)

Referenced by test_gettext().

◆ simulate_click()

static void simulate_click ( int  x,
int  y 
)
static

Definition at line 8307 of file win.c.

8308{
8309 INPUT input[2];
8310 UINT events_no;
8311
8312 SetCursorPos(x, y);
8313 memset(input, 0, sizeof(input));
8314 input[0].type = INPUT_MOUSE;
8315 U(input[0]).mi.dx = x;
8316 U(input[0]).mi.dy = y;
8317 U(input[0]).mi.dwFlags = MOUSEEVENTF_LEFTDOWN;
8318 input[1].type = INPUT_MOUSE;
8319 U(input[1]).mi.dx = x;
8320 U(input[1]).mi.dy = y;
8321 U(input[1]).mi.dwFlags = MOUSEEVENTF_LEFTUP;
8322 events_no = SendInput(2, input, sizeof(input[0]));
8323 ok(events_no == 2, "SendInput returned %d\n", events_no);
8324}
#define U(x)
Definition: wordpad.c:45
GLenum GLenum GLenum input
Definition: glext.h:9031
UINT WINAPI SendInput(UINT, LPINPUT, int)
Definition: ntwrapper.h:344
#define INPUT_MOUSE
Definition: winable.h:9
#define MOUSEEVENTF_LEFTUP
Definition: winuser.h:1185
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2693
#define MOUSEEVENTF_LEFTDOWN
Definition: winuser.h:1184

Referenced by START_TEST(), and test_window_from_point().

◆ smresult_thread_proc()

static DWORD WINAPI smresult_thread_proc ( void param)
static

Definition at line 8846 of file win.c.

8847{
8848 MSG msg;
8850
8851 data->thread_hwnd = CreateWindowExA(0, "SmresultClass", "window caption text", WS_OVERLAPPEDWINDOW,
8852 100, 100, 200, 200, 0, 0, 0, NULL);
8853 ok(data->thread_hwnd != 0, "Failed to create overlapped window\n");
8854
8855 SetEvent(data->thread_started);
8856
8857 /* Loop until we've processed WM_APP. */
8858 while (WaitForSingleObject(data->thread_got_wm_app, 0) != WAIT_OBJECT_0)
8859 {
8860 if (PeekMessageA(&msg, 0, 0, 0, PM_REMOVE))
8861 {
8864 }
8865 else
8866 {
8867 MsgWaitForMultipleObjects(1, &data->thread_got_wm_app, FALSE, INFINITE, QS_SENDMESSAGE);
8868 }
8869 }
8870
8871 /* Notify the main thread that we replied to its WM_APP message. */
8872 SetEvent(data->thread_replied);
8873
8874 while (GetMessageA(&msg, 0, 0, 0))
8875 {
8878 }
8879
8880 return 0;
8881}
#define QS_SENDMESSAGE
Definition: winuser.h:880

Referenced by test_smresult().

◆ smresult_wndproc()

static LRESULT WINAPI smresult_wndproc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 8789 of file win.c.

8790{
8791 switch (msg)
8792 {
8793 case WM_APP:
8794 {
8796
8797 ok(hwnd == data->thread_hwnd, "unexpected hwnd %p\n", hwnd);
8798
8799 SendNotifyMessageA(data->main_hwnd, WM_APP+1, 0, lparam);
8800
8801 /* Don't return until the main thread is processing our sent message. */
8802 ok(WaitForSingleObject(data->main_in_wm_app_1, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
8803
8804 /* Break the PeekMessage loop so we can notify the main thread after we return. */
8805 SetEvent(data->thread_got_wm_app);
8806
8807 return 0x240408ea;
8808 }
8809 case WM_APP+1:
8810 {
8812 LRESULT res;
8813
8814 ok(hwnd == data->main_hwnd, "unexpected hwnd %p\n", hwnd);
8815
8816 /* Ask the thread to reply to our WM_APP message. */
8817 SetEvent(data->main_in_wm_app_1);
8818
8819 /* Wait until the thread has sent a reply. */
8820 ok(WaitForSingleObject(data->thread_replied, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
8821
8822 /* Send another message while we have a reply queued for the current one. */
8823 res = SendMessageA(data->thread_hwnd, WM_APP+2, 0, lparam);
8824 ok(res == 0x449b0190, "unexpected result %lx\n", res);
8825
8826 return 0;
8827 }
8828 case WM_APP+2:
8829 {
8831
8832 ok(hwnd == data->thread_hwnd, "unexpected hwnd %p\n", hwnd);
8833
8834 /* Don't return until we know the main thread is processing sent messages. */
8835 SendMessageA(data->main_hwnd, WM_NULL, 0, 0);
8836
8837 return 0x449b0190;
8838 }
8839 case WM_CLOSE:
8840 PostQuitMessage(0);
8841 break;
8842 }
8843 return DefWindowProcA(hwnd, msg, wparam, lparam);
8844}
#define WM_APP
Definition: eventvwr.h:73
#define WM_NULL
Definition: winuser.h:1607

Referenced by test_smresult().

◆ START_TEST()

START_TEST ( win  )

Definition at line 9405 of file win.c.

9406{
9407 char **argv;
9409 HMODULE user32 = GetModuleHandleA( "user32.dll" );
9410 HMODULE gdi32 = GetModuleHandleA("gdi32.dll");
9411 pGetAncestor = (void *)GetProcAddress( user32, "GetAncestor" );
9412 pGetWindowInfo = (void *)GetProcAddress( user32, "GetWindowInfo" );
9413 pGetWindowModuleFileNameA = (void *)GetProcAddress( user32, "GetWindowModuleFileNameA" );
9414 pGetLayeredWindowAttributes = (void *)GetProcAddress( user32, "GetLayeredWindowAttributes" );
9415 pSetLayeredWindowAttributes = (void *)GetProcAddress( user32, "SetLayeredWindowAttributes" );
9416 pUpdateLayeredWindow = (void *)GetProcAddress( user32, "UpdateLayeredWindow" );
9417 pUpdateLayeredWindowIndirect = (void *)GetProcAddress( user32, "UpdateLayeredWindowIndirect" );
9418 pGetMonitorInfoA = (void *)GetProcAddress( user32, "GetMonitorInfoA" );
9419 pMonitorFromPoint = (void *)GetProcAddress( user32, "MonitorFromPoint" );
9420 pGetWindowRgnBox = (void *)GetProcAddress( user32, "GetWindowRgnBox" );
9421 pGetGUIThreadInfo = (void *)GetProcAddress( user32, "GetGUIThreadInfo" );
9422 pGetProcessDefaultLayout = (void *)GetProcAddress( user32, "GetProcessDefaultLayout" );
9423 pSetProcessDefaultLayout = (void *)GetProcAddress( user32, "SetProcessDefaultLayout" );
9424 pFlashWindow = (void *)GetProcAddress( user32, "FlashWindow" );
9425 pFlashWindowEx = (void *)GetProcAddress( user32, "FlashWindowEx" );
9426 pGetLayout = (void *)GetProcAddress( gdi32, "GetLayout" );
9427 pSetLayout = (void *)GetProcAddress( gdi32, "SetLayout" );
9428 pMirrorRgn = (void *)GetProcAddress( gdi32, "MirrorRgn" );
9429
9430 if (argc==4 && !strcmp(argv[2], "create_children"))
9431 {
9432 HWND hwnd;
9433
9434 sscanf(argv[3], "%p", &hwnd);
9436 return;
9437 }
9438
9439 if (argc==3 && !strcmp(argv[2], "winproc_limit"))
9440 {
9442 return;
9443 }
9444
9445 if (!RegisterWindowClasses()) assert(0);
9446
9447 hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window",
9450 100, 100, 200, 200,
9451 0, 0, GetModuleHandleA(NULL), NULL);
9452 assert( hwndMain );
9453
9455 /* workaround for foreground lock timeout */
9456 simulate_click(101, 101);
9457 ok(SetForegroundWindow(hwndMain), "SetForegroundWindow failed\n");
9458 }
9459
9460 SetLastError(0xdeafbeef);
9463
9465 if (!hhook) win_skip( "Cannot set CBT hook, skipping some tests\n" );
9466
9467 /* make sure that these tests are executed first */
9470
9471 hwndMain2 = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window 2",
9474 100, 100, 200, 200,
9475 0, 0, GetModuleHandleA(NULL), NULL);
9476 assert( hwndMain2 );
9477
9479
9480 /* Add the tests below this line */
9487 test_params();
9496
9500
9501 test_mdi();
9502 test_icons();
9507 test_NCRedraw();
9508
9513