ReactOS 0.4.16-dev-2491-g3dc6630
dialog.c File Reference
#include <assert.h>
#include <stdio.h>
#include <stdarg.h>
#include "wine/test.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
Include dependency graph for dialog.c:

Go to the source code of this file.

Classes

struct  h_entry
 
struct  test_record
 

Macros

#define MAXHWNDS   1024
 

Enumerations

enum  defdlgproc_text {
  DLGPROCTEXT_SNDMSGA = 0 , DLGPROCTEXT_SNDMSGW , DLGPROCTEXT_DLGPROCA , DLGPROCTEXT_DLGPROCW ,
  DLGPROCTEXT_SETTEXTA , DLGPROCTEXT_SETTEXTW
}
 

Functions

static DWORD get_button_style (HWND button)
 
static BOOL CreateWindows (HINSTANCE hinst)
 
static DWORD KeyDownData (int repeat, int scancode, int extended, int wasdown)
 
static void FormTabMsg (MSG *pMsg, HWND hwnd)
 
static void FormEnterMsg (MSG *pMsg, HWND hwnd)
 
static int id (HWND h)
 
static void test_GetNextDlgItem (void)
 
static BOOL OnMainWindowCreate (HWND hwnd, LPCREATESTRUCTA lpcs)
 
static BOOL OnTestDlgCreate (HWND hwnd, LPCREATESTRUCTA lpcs)
 
static LRESULT CALLBACK main_window_procA (HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK disabled_test_proc (HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK testDlgWinProc (HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK test_control_procA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static BOOL is_cjk (void)
 
static LRESULT CALLBACK test_IsDialogMessageA_proc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static BOOL RegisterWindowClasses (void)
 
static void test_WM_NEXTDLGCTL (void)
 
static LRESULT CALLBACK hook_proc (INT code, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK hook_proc2 (INT code, WPARAM wParam, LPARAM lParam)
 
static void test_IsDialogMessage (void)
 
static INT_PTR CALLBACK delayFocusDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK focusDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK EmptyProcUserTemplate (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK focusChildDlgWinProc (HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static const charGetHwndString (HWND hw)
 
static void test_focus (void)
 
static void test_GetDlgItemText (void)
 
static INT_PTR CALLBACK getdlgitem_test_dialog_proc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_GetDlgItem (void)
 
static INT_PTR CALLBACK DestroyDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK DestroyOnCloseDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK TestInitDialogHandleProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK TestDefButtonDlgProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK TestReturnKeyDlgProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK TestControlStyleDlgProc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK test_aw_conversion_dlgprocA (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK test_aw_conversion_dlgprocW (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void dlg_test_aw_message (HWND hdlg, UINT msg)
 
static INT_PTR CALLBACK test_aw_conversion_dlgproc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK test_aw_conversion_dlgproc2 (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK test_aw_conversion_wndproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK test_aw_conversion_dlgproc3 (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_DialogBoxParam (void)
 
static void test_DisabledDialogTest (void)
 
static INT_PTR CALLBACK messageBoxFontDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static void test_MessageBoxFontTest (void)
 
static void test_SaveRestoreFocus (void)
 
static INT_PTR CALLBACK timer_message_dlg_proc (HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_timer_message (void)
 
static LRESULT CALLBACK msgbox_hook_proc (INT code, WPARAM wParam, LPARAM lParam)
 
static void test_MessageBox (void)
 
static INT_PTR CALLBACK custom_test_dialog_proc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_dialog_custom_data (void)
 
static INT_PTR CALLBACK capture_release_proc (HWND dialog, UINT message, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK capture_release_modeless_proc (HWND dialog, UINT message, WPARAM wparam, LPARAM lparam)
 
static void test_capture_release (void)
 
static LRESULT WINAPI test_static_create_procW (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT WINAPI test_static_create_procA (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_create_controls (void)
 
 START_TEST (dialog)
 

Variables

static HWND hwnd [MAXHWNDS]
 
static unsigned int numwnds =1
 
static HINSTANCE g_hinst
 
static HWND g_hwndMain
 
static HWND g_hwndButton1
 
static HWND g_hwndButton2
 
static HWND g_hwndButtonCancel
 
static HWND g_hwndTestDlg
 
static HWND g_hwndTestDlgBut1
 
static HWND g_hwndTestDlgBut2
 
static HWND g_hwndTestDlgEdit
 
static HWND g_hwndInitialFocusT1
 
static HWND g_hwndInitialFocusT2
 
static HWND g_hwndInitialFocusGroupBox
 
static LONG g_styleInitialFocusT1
 
static LONG g_styleInitialFocusT2
 
static BOOL g_bInitialFocusInitDlgResult
 
static BOOL g_bReceivedCommand
 
static BOOL g_terminated
 
static BOOL g_button1Clicked
 
static const h_entry hierarchy []
 
static int wm_char_count
 
static BOOL g_MSGF_DIALOGBOX
 
static const WCHAR testtextW [] = {'W','n','d','T','e','x','t',0}
 
static const chartesttext = "WndText"
 
static const chartestmodes []
 
static unsigned int msgbox_hook_proc_called
 
static UINT msgbox_type
 
static WNDPROC orig_static_proc
 
static WCHAR cs_name_paramW [3]
 
static char cs_name_paramA [4]
 

Macro Definition Documentation

◆ MAXHWNDS

#define MAXHWNDS   1024

Definition at line 43 of file dialog.c.

Enumeration Type Documentation

◆ defdlgproc_text

Enumerator
DLGPROCTEXT_SNDMSGA 
DLGPROCTEXT_SNDMSGW 
DLGPROCTEXT_DLGPROCA 
DLGPROCTEXT_DLGPROCW 
DLGPROCTEXT_SETTEXTA 
DLGPROCTEXT_SETTEXTW 

Definition at line 1461 of file dialog.c.

1462{
1469};
@ DLGPROCTEXT_SNDMSGA
Definition: dialog.c:1463
@ DLGPROCTEXT_SETTEXTW
Definition: dialog.c:1468
@ DLGPROCTEXT_DLGPROCW
Definition: dialog.c:1466
@ DLGPROCTEXT_DLGPROCA
Definition: dialog.c:1465
@ DLGPROCTEXT_SNDMSGW
Definition: dialog.c:1464
@ DLGPROCTEXT_SETTEXTA
Definition: dialog.c:1467

Function Documentation

◆ capture_release_modeless_proc()

static INT_PTR CALLBACK capture_release_modeless_proc ( HWND  dialog,
UINT  message,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 2327 of file dialog.c.

2328{
2329 if (message == WM_INITDIALOG)
2330 {
2331 HWND child = (HWND)lparam;
2332 DWORD style;
2333
2334 ok(GetCapture() == child, "got capture %p\n", GetCapture());
2336 ok(!(style & WS_DISABLED), "child should not be disabled\n");
2337
2338 PostMessageA(dialog, WM_QUIT, 0, 0);
2339 }
2340 return FALSE;
2341}
@ lparam
Definition: SystemMenu.c:31
Arabic default style
Definition: afstyles.h:94
#define ok(value,...)
Definition: atltest.h:57
#define FALSE
Definition: types.h:117
HANDLE HWND
Definition: compat.h:19
unsigned long DWORD
Definition: ntddk_ex.h:95
static HWND child
Definition: cursoricon.c:298
static HWND dialog
Definition: gui.c:33
#define WS_DISABLED
Definition: pedump.c:621
Definition: tftpd.h:60
#define WM_QUIT
Definition: winuser.h:1651
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_INITDIALOG
Definition: winuser.h:1767
#define GWL_STYLE
Definition: winuser.h:863
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_capture_release().

◆ capture_release_proc()

static INT_PTR CALLBACK capture_release_proc ( HWND  dialog,
UINT  message,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 2300 of file dialog.c.

2301{
2302 if (message == WM_INITDIALOG)
2303 {
2304 HWND child = (HWND)lparam;
2305 DWORD style;
2306
2307 ok(GetCapture() == child, "got capture %p\n", GetCapture());
2309 ok(!(style & WS_DISABLED), "child should not be disabled\n");
2310
2312 }
2313 else if (message == WM_USER)
2314 {
2315 HWND child = (HWND)lparam;
2316 DWORD style;
2317
2318 ok(!GetCapture(), "got capture %p\n", GetCapture());
2320 ok(!(style & WS_DISABLED), "child should not be disabled\n");
2321
2322 EndDialog(dialog, 1);
2323 }
2324 return FALSE;
2325}
LONG_PTR LPARAM
Definition: minwindef.h:175
#define WM_USER
Definition: winuser.h:1923
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by test_capture_release().

◆ CreateWindows()

static BOOL CreateWindows ( HINSTANCE  hinst)
static

Definition at line 155 of file dialog.c.

156{
157 const h_entry *p = hierarchy;
158
159 while (p->id != 0)
160 {
161 DWORD style, exstyle;
162 char ctrlname[16];
163
164 /* Basically assert that the hierarchy is valid and track the
165 * maximum control number
166 */
167 if (p->id >= numwnds)
168 {
169 if (p->id >= ARRAY_SIZE(hwnd))
170 {
171 trace ("Control %Id is out of range\n", p->id);
172 return FALSE;
173 }
174 else
175 numwnds = p->id+1;
176 }
177 if (p->id <= 0)
178 {
179 trace ("Control %Id is out of range\n", p->id);
180 return FALSE;
181 }
182 if (hwnd[p->id] != 0)
183 {
184 trace ("Control %Id is used more than once\n", p->id);
185 return FALSE;
186 }
187
188 /* Create the control */
189 sprintf (ctrlname, "ctrl%4.4Id", p->id);
190 hwnd[p->id] = CreateWindowExA(p->exstyle, p->parent ? "static" : "GetNextDlgItemWindowClass", ctrlname, p->style, 10, 10, 10, 10, hwnd[p->parent], p->parent ? (HMENU) (2000 + p->id) : 0, hinst, 0);
191 if (!hwnd[p->id])
192 {
193 trace ("Failed to create control %Id\n", p->id);
194 return FALSE;
195 }
196
197 /* Check that the styles are as we specified (except the main one
198 * which is quite frequently messed up). If this keeps breaking then
199 * we could mask out the bits that don't concern us.
200 */
201 if (p->parent)
202 {
204 exstyle = GetWindowLongA(hwnd[p->id], GWL_EXSTYLE);
205 if (style != p->style || exstyle != p->exstyle)
206 {
207 trace ("Style mismatch at %Id: %8.8lx %8.8lx cf %8.8lx %8.8lx\n", p->id, style, exstyle, p->style, p->exstyle);
208 }
209 }
210 p++;
211 }
212
213 return TRUE;
214}
#define trace
Definition: atltest.h:70
#define ARRAY_SIZE(A)
Definition: main.h:20
#define TRUE
Definition: types.h:120
GLfloat GLfloat p
Definition: glext.h:8902
#define sprintf
Definition: sprintf.c:45
static HINSTANCE hinst
Definition: edit.c:551
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static unsigned int numwnds
Definition: dialog.c:45
static const h_entry hierarchy[]
Definition: dialog.c:66
Definition: dialog.c:59
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
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)
#define GWL_EXSTYLE
Definition: winuser.h:862

Referenced by test_GetNextDlgItem().

◆ custom_test_dialog_proc()

static INT_PTR CALLBACK custom_test_dialog_proc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 2287 of file dialog.c.

2288{
2289 if (msg == WM_INITDIALOG)
2290 EndDialog(hdlg, 0);
2291
2292 return FALSE;
2293}
#define msg(x)
Definition: auth_time.c:54

Referenced by test_dialog_custom_data().

◆ delayFocusDlgWinProc()

static INT_PTR CALLBACK delayFocusDlgWinProc ( HWND  hDlg,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 898 of file dialog.c.

900{
901 switch (uiMsg)
902 {
903 case WM_INITDIALOG:
904 g_hwndMain = hDlg;
906 g_hwndButton1 = GetDlgItem(hDlg,200);
907 g_hwndButton2 = GetDlgItem(hDlg,201);
910
911 /* Initially check the second radio button */
914 /* Continue testing after dialog initialization */
915 PostMessageA(hDlg, WM_USER, 0, 0);
917
918 case WM_COMMAND:
919 if (LOWORD(wParam) == IDCANCEL)
920 {
921 EndDialog(hDlg, LOWORD(wParam));
922 return TRUE;
923 }
924 return FALSE;
925
926 case WM_USER:
929 SetFocus(hDlg);
932 return TRUE;
933 }
934
935 return FALSE;
936}
WPARAM wParam
Definition: combotst.c:138
static HWND g_hwndInitialFocusT1
Definition: dialog.c:51
static LONG g_styleInitialFocusT1
Definition: dialog.c:53
static BOOL g_bInitialFocusInitDlgResult
Definition: dialog.c:54
static HWND g_hwndInitialFocusT2
Definition: dialog.c:51
static HWND g_hwndButtonCancel
Definition: dialog.c:49
static HWND g_hwndButton1
Definition: dialog.c:49
static HWND g_hwndInitialFocusGroupBox
Definition: dialog.c:51
static HWND g_hwndMain
Definition: dialog.c:49
static LONG g_styleInitialFocusT2
Definition: dialog.c:53
static HWND g_hwndButton2
Definition: dialog.c:49
#define LOWORD(l)
Definition: pedump.c:82
HWND WINAPI GetFocus(void)
Definition: window.c:1863
#define IDCANCEL
Definition: winuser.h:842
#define BST_UNCHECKED
Definition: winuser.h:199
#define WM_COMMAND
Definition: winuser.h:1768
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define BM_SETCHECK
Definition: winuser.h:1950
HWND WINAPI SetFocus(_In_opt_ HWND)
#define BST_CHECKED
Definition: winuser.h:197

Referenced by test_focus().

◆ DestroyDlgWinProc()

static INT_PTR CALLBACK DestroyDlgWinProc ( HWND  hDlg,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1325 of file dialog.c.

1327{
1328 if (uiMsg == WM_INITDIALOG)
1329 {
1330 DestroyWindow(hDlg);
1331 return TRUE;
1332 }
1333 return FALSE;
1334}
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by test_DialogBoxParam().

◆ DestroyOnCloseDlgWinProc()

static INT_PTR CALLBACK DestroyOnCloseDlgWinProc ( HWND  hDlg,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1336 of file dialog.c.

1338{
1339 switch (uiMsg)
1340 {
1341 case WM_INITDIALOG:
1342 PostMessageA(hDlg, WM_CLOSE, 0, 0);
1343 return TRUE;
1344 case WM_CLOSE:
1345 DestroyWindow(hDlg);
1346 return TRUE;
1347 case WM_DESTROY:
1348 PostQuitMessage(0);
1349 return TRUE;
1350 }
1351 return FALSE;
1352}
#define WM_CLOSE
Definition: winuser.h:1649
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_DESTROY
Definition: winuser.h:1637

Referenced by test_create_controls(), and test_DialogBoxParam().

◆ disabled_test_proc()

static INT_PTR CALLBACK disabled_test_proc ( HWND  hwnd,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 492 of file dialog.c.

494{
495 switch (uiMsg)
496 {
497 case WM_INITDIALOG:
498 {
499 DWORD dw;
500 HWND hwndOk;
501
504 hwndOk = GetDlgItem(hwnd, LOWORD(dw));
505 assert(hwndOk);
506 EnableWindow(hwndOk, FALSE);
507
510 break;
511 }
512 case WM_COMMAND:
513 if (wParam == IDOK)
514 {
516 EndDialog(hwnd, 0);
517 return 0;
518 }
519 else if (wParam == IDCANCEL)
520 {
521 EndDialog(hwnd, 0);
522 return 0;
523 }
524 break;
525 }
526
527 return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
528}
LPARAM lParam
Definition: combotst.c:139
#define assert(_expr)
Definition: assert.h:32
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
static BOOL g_terminated
Definition: dialog.c:56
#define HIWORD(l)
Definition: typedefs.h:247
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DC_HASDEFID
Definition: winuser.h:2651
#define IDOK
Definition: winuser.h:841
#define VK_RETURN
Definition: winuser.h:2237
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define WM_KEYDOWN
Definition: winuser.h:1743
#define DM_GETDEFID
Definition: winuser.h:2134

Referenced by test_DisabledDialogTest().

◆ dlg_test_aw_message()

static void dlg_test_aw_message ( HWND  hdlg,
UINT  msg 
)
static

Definition at line 1579 of file dialog.c.

1580{
1581 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SNDMSGA));
1582 SendMessageA(hdlg, msg, 0, (LPARAM)testtext);
1583
1584 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SNDMSGW));
1585 SendMessageW(hdlg, msg, 0, (LPARAM)testtextW);
1586
1587 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_DLGPROCA));
1588 DefDlgProcA(hdlg, msg, 0, (LPARAM)testtext);
1589
1590 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_DLGPROCW));
1591 DefDlgProcW(hdlg, msg, 0, (LPARAM)testtextW);
1592}
#define ULongToHandle(h)
Definition: basetsd.h:75
static const char * testtext
Definition: dialog.c:1459
static const WCHAR testtextW[]
Definition: dialog.c:1458
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
LRESULT WINAPI DefDlgProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI DefDlgProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_aw_conversion_dlgproc(), test_aw_conversion_dlgproc2(), and test_aw_conversion_dlgproc3().

◆ EmptyProcUserTemplate()

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

Definition at line 959 of file dialog.c.

960{
961 switch(uMsg) {
962 case WM_INITDIALOG:
963 return TRUE;
964 }
965 return FALSE;
966}

Referenced by focusChildDlgWinProc().

◆ focusChildDlgWinProc()

static INT_PTR CALLBACK focusChildDlgWinProc ( HWND  hwnd,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 968 of file dialog.c.

970{
971 static HWND hChildDlg;
972
973 switch (uiMsg)
974 {
975 case WM_INITDIALOG:
976 {
977 RECT rectHwnd;
978 struct {
979 DLGTEMPLATE tmplate;
980 WORD menu,class,title;
981 } temp;
982
983 SetFocus( GetDlgItem(hwnd, 200) );
984
985 GetClientRect(hwnd,&rectHwnd);
987 temp.tmplate.dwExtendedStyle = 0;
988 temp.tmplate.cdit = 0;
989 temp.tmplate.x = 0;
990 temp.tmplate.y = 0;
991 temp.tmplate.cx = 0;
992 temp.tmplate.cy = 0;
993 temp.menu = temp.class = temp.title = 0;
994
995 hChildDlg = CreateDialogIndirectParamA(g_hinst, &temp.tmplate,
997 ok(hChildDlg != 0, "Failed to create test dialog.\n");
998
999 return FALSE;
1000 }
1001 case WM_CLOSE:
1002 DestroyWindow(hChildDlg);
1003 return TRUE;
1004 }
1005
1006 return FALSE;
1007}
#define DLGPROC
Definition: maze.c:62
unsigned short WORD
Definition: ntddk_ex.h:93
static INT_PTR CALLBACK EmptyProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:959
static HINSTANCE g_hinst
Definition: dialog.c:48
#define menu
Definition: input.c:3273
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
static char title[]
Definition: ps.c:92
static calc_node_t temp
Definition: rpn_ieee.c:38
#define DS_3DLOOK
Definition: winuser.h:367
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
HWND WINAPI CreateDialogIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
#define DS_CONTROL
Definition: winuser.h:372

Referenced by test_focus().

◆ focusDlgWinProc()

static INT_PTR CALLBACK focusDlgWinProc ( HWND  hDlg,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 938 of file dialog.c.

940{
941 switch (uiMsg)
942 {
943 case WM_INITDIALOG:
944 SetWindowTextA(GetDlgItem(hDlg, 200), "new caption");
945 return TRUE;
946
947 case WM_COMMAND:
948 if (LOWORD(wParam) == 200)
949 {
950 if (HIWORD(wParam) == EN_SETFOCUS)
952 }
953 return FALSE;
954 }
955
956 return FALSE;
957}
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define EN_SETFOCUS
Definition: winuser.h:2056

Referenced by test_focus().

◆ FormEnterMsg()

static void FormEnterMsg ( MSG pMsg,
HWND  hwnd 
)
static

Definition at line 235 of file dialog.c.

236{
237 pMsg->hwnd = hwnd;
238 pMsg->message = WM_KEYDOWN;
239 pMsg->wParam = VK_RETURN;
240 pMsg->lParam = KeyDownData (1, 0x1C, 0, 0);
241 /* pMsg->time is not set. It shouldn't be needed */
242 /* pMsg->pt is ignored */
243}
static DWORD KeyDownData(int repeat, int scancode, int extended, int wasdown)
Definition: dialog.c:217

Referenced by test_IsDialogMessage(), and test_WM_NEXTDLGCTL().

◆ FormTabMsg()

static void FormTabMsg ( MSG pMsg,
HWND  hwnd 
)
static

Definition at line 224 of file dialog.c.

225{
226 pMsg->hwnd = hwnd;
227 pMsg->message = WM_KEYDOWN;
228 pMsg->wParam = VK_TAB;
229 pMsg->lParam = KeyDownData (1, 0x0F, 0, 0);
230 /* pMsg->time is not set. It shouldn't be needed */
231 /* pMsg->pt is ignored */
232}
#define VK_TAB
Definition: winuser.h:2235

Referenced by test_IsDialogMessage().

◆ get_button_style()

static DWORD get_button_style ( HWND  button)
static

Definition at line 150 of file dialog.c.

151{
153}
DWORD button
Definition: button.c:166
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define BS_TYPEMASK
Definition: winuser.h:270

Referenced by test_WM_NEXTDLGCTL().

◆ getdlgitem_test_dialog_proc()

static INT_PTR CALLBACK getdlgitem_test_dialog_proc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1233 of file dialog.c.

1234{
1235 if (msg == WM_INITDIALOG)
1236 {
1237 char text[64];
1238 LONG_PTR val;
1239 HWND hwnd;
1240 BOOL ret;
1241
1242 hwnd = GetDlgItem(hdlg, -1);
1243 ok(hwnd != NULL, "Expected dialog item.\n");
1244
1245 *text = 0;
1246 ret = GetDlgItemTextA(hdlg, -1, text, ARRAY_SIZE(text));
1247 ok(ret && !strcmp(text, "Text1"), "Unexpected item text.\n");
1248
1250 ok(val == -1, "Unexpected id.\n");
1251
1253 ok(val == -1, "Unexpected id %Id.\n", val);
1254
1255 hwnd = GetDlgItem(hdlg, -2);
1256 ok(hwnd != NULL, "Expected dialog item.\n");
1257
1259 ok(val == -2, "Unexpected id.\n");
1260
1262 ok(val == -2, "Unexpected id %Id.\n", val);
1263
1264 EndDialog(hdlg, 0xdead);
1265 }
1266
1267 return FALSE;
1268}
#define NULL
Definition: types.h:112
const WCHAR * text
Definition: package.c:1794
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLfloat * val
Definition: glext.h:7180
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
UINT WINAPI GetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPSTR lpString, int nMaxCount)
Definition: dialog.c:2245
#define GetWindowLongPtrA
Definition: winuser.h:4982
#define GWLP_ID
Definition: winuser.h:871

Referenced by test_GetDlgItem().

◆ GetHwndString()

static const char * GetHwndString ( HWND  hw)
static

Definition at line 1010 of file dialog.c.

1011{
1012 if (hw == NULL)
1013 return "a null handle";
1014 if (hw == g_hwndMain)
1015 return "the dialog handle";
1017 return "the group box control";
1018 if (hw == g_hwndButton1)
1019 return "the first button";
1020 if (hw == g_hwndButton2)
1021 return "the second button";
1022 if (hw == g_hwndButtonCancel)
1023 return "the cancel button";
1024
1025 return "unknown handle";
1026}

Referenced by test_focus().

◆ hook_proc()

static LRESULT CALLBACK hook_proc ( INT  code,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 759 of file dialog.c.

760{
761 ok(0, "unexpected hook called, code %d\n", code);
763}
Definition: inflate.c:139
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)

Referenced by test_IsDialogMessage().

◆ hook_proc2()

static LRESULT CALLBACK hook_proc2 ( INT  code,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 766 of file dialog.c.

767{
768 ok(code == MSGF_DIALOGBOX, "unexpected hook called, code %d\n", code);
771}
static BOOL g_MSGF_DIALOGBOX
Definition: dialog.c:765
#define MSGF_DIALOGBOX
Definition: winuser.h:1184

Referenced by test_IsDialogMessage().

◆ id()

static int id ( HWND  h)
static

Definition at line 261 of file dialog.c.

262{
263 unsigned int i;
264 for (i = 0; i < numwnds; i++)
265 if (hwnd[i] == h)
266 return i;
267 return -1;
268}
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
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

◆ is_cjk()

static BOOL is_cjk ( void  )
static

Definition at line 573 of file dialog.c.

574{
575 int lang_id = PRIMARYLANGID(GetUserDefaultLangID());
576
577 if (lang_id == LANG_CHINESE || lang_id == LANG_JAPANESE || lang_id == LANG_KOREAN)
578 return TRUE;
579 return FALSE;
580}
LANGID WINAPI GetUserDefaultLangID(void)
Definition: locale.c:1182
#define LANG_CHINESE
Definition: nls.h:42
#define LANG_JAPANESE
Definition: nls.h:76
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define LANG_KOREAN
Definition: nls.h:84

Referenced by test_IsDialogMessage(), and test_IsDialogMessageA_proc().

◆ KeyDownData()

static DWORD KeyDownData ( int  repeat,
int  scancode,
int  extended,
int  wasdown 
)
static

Definition at line 217 of file dialog.c.

218{
219 return ((repeat & 0x0000FFFF) | ((scancode & 0x00FF) << 16) |
220 (extended ? 0x01000000 : 0) | (wasdown ? 0x40000000 : 0));
221}

Referenced by FormEnterMsg(), and FormTabMsg().

◆ main_window_procA()

static LRESULT CALLBACK main_window_procA ( HWND  hwnd,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 462 of file dialog.c.

464{
465 switch (uiMsg)
466 {
467 /* Add blank case statements for these to ensure we don't use them
468 * by mistake.
469 */
470 case DM_GETDEFID: break;
471 case DM_SETDEFID: break;
472
473 case WM_CREATE:
474 return (OnMainWindowCreate (hwnd,
475 (LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1);
476 case WM_COMMAND:
477 if (wParam == IDCANCEL)
478 {
480 return 0;
481 }
482 else if ((wParam == 100 || wParam == 0xFFFF) && lParam)
483 {
485 }
486 break;
487 }
488
489 return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
490}
LONG_PTR LRESULT
Definition: minwindef.h:176
static BOOL OnMainWindowCreate(HWND hwnd, LPCREATESTRUCTA lpcs)
Definition: dialog.c:411
static BOOL g_button1Clicked
Definition: dialog.c:57
#define DM_SETDEFID
Definition: winuser.h:2135
#define WM_CREATE
Definition: winuser.h:1636

Referenced by RegisterWindowClasses().

◆ messageBoxFontDlgWinProc()

static INT_PTR CALLBACK messageBoxFontDlgWinProc ( HWND  hDlg,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1971 of file dialog.c.

1973{
1974 if (uiMsg == WM_INITDIALOG) {
1975 SetFocus(hDlg);
1976 return 1;
1977 }
1978
1979 return 0;
1980}

Referenced by test_MessageBoxFontTest(), and test_SaveRestoreFocus().

◆ msgbox_hook_proc()

static LRESULT CALLBACK msgbox_hook_proc ( INT  code,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2204 of file dialog.c.

2205{
2206 static const LONG considered_ex_styles = WS_EX_CONTROLPARENT | WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME | WS_EX_TOPMOST;
2207
2208 if (code == HCBT_ACTIVATE)
2209 {
2210 HWND msgbox = (HWND)wParam, msghwnd;
2211 LONG exstyles, expected_exstyles;
2212 BOOL system_modal;
2213 char text[64];
2214
2215 if (msgbox)
2216 {
2217 exstyles = GetWindowLongA(msgbox, GWL_EXSTYLE) & considered_ex_styles;
2218
2220 system_modal = msgbox_type & MB_SYSTEMMODAL && !(msgbox_type & MB_TASKMODAL);
2221 expected_exstyles = WS_EX_CONTROLPARENT | WS_EX_WINDOWEDGE;
2222 if ((msgbox_type & MB_TOPMOST) || system_modal)
2223 expected_exstyles |= WS_EX_TOPMOST;
2224 if (!system_modal)
2225 expected_exstyles |= WS_EX_DLGMODALFRAME;
2226
2227 todo_wine_if(system_modal && exstyles == (expected_exstyles | WS_EX_DLGMODALFRAME))
2228#ifdef __REACTOS__
2229 ok(exstyles == expected_exstyles || broken(exstyles == (expected_exstyles & ~WS_EX_TOPMOST)) /* Vista */, "got %#lx, expected %#lx\n", exstyles, expected_exstyles);
2230#else
2231 ok(exstyles == expected_exstyles, "got %#lx, expected %#lx\n", exstyles, expected_exstyles);
2232#endif
2233
2234 text[0] = 0;
2235 GetWindowTextA(msgbox, text, sizeof(text));
2236 ok(!strcmp(text, "MSGBOX caption"), "Unexpected window text \"%s\"\n", text);
2237
2238 msghwnd = GetDlgItem(msgbox, 0xffff);
2239 ok(msghwnd != NULL, "Expected static control\n");
2240
2241 text[0] = 0;
2242 GetWindowTextA(msghwnd, text, sizeof(text));
2243
2245 ok(!strcmp(text, "Text"), "Unexpected window text \"%s\"\n", text);
2246
2249 }
2250 }
2251
2253}
#define broken(x)
Definition: atltest.h:178
#define todo_wine_if(is_todo)
Definition: minitest.h:81
static unsigned int msgbox_hook_proc_called
Definition: dialog.c:2201
static UINT msgbox_type
Definition: dialog.c:2202
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_EX_TOPMOST
Definition: pedump.c:647
long LONG
Definition: pedump.c:60
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1300
#define MB_TOPMOST
Definition: winuser.h:836
#define MB_SYSTEMMODAL
Definition: winuser.h:826
#define WS_EX_CONTROLPARENT
Definition: winuser.h:387
#define HCBT_ACTIVATE
Definition: winuser.h:60
#define MB_TASKMODAL
Definition: winuser.h:827
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
#define MB_OKCANCEL
Definition: winuser.h:815
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define WM_LBUTTONUP
Definition: winuser.h:1805
LRESULT WINAPI SendDlgItemMessageA(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_MessageBox().

◆ OnMainWindowCreate()

static BOOL OnMainWindowCreate ( HWND  hwnd,
LPCREATESTRUCTA  lpcs 
)
static

Definition at line 411 of file dialog.c.

412{
413 g_hwndButton1 = CreateWindowA("button", "Button &1",
415 10, 10, 80, 80, hwnd, (HMENU)100, g_hinst, 0);
416 if (!g_hwndButton1) return FALSE;
417
418 g_hwndButton2 = CreateWindowA("button", "Button &2",
420 110, 10, 80, 80, hwnd, (HMENU)200, g_hinst, 0);
421 if (!g_hwndButton2) return FALSE;
422
423 g_hwndButtonCancel = CreateWindowA("button", "Cancel",
425 210, 10, 80, 80, hwnd, (HMENU)IDCANCEL, g_hinst, 0);
426 if (!g_hwndButtonCancel) return FALSE;
427
428 return TRUE;
429}
#define WS_TABSTOP
Definition: pedump.c:634
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4469
#define BS_TEXT
Definition: winuser.h:276

Referenced by main_window_procA().

◆ OnTestDlgCreate()

static BOOL OnTestDlgCreate ( HWND  hwnd,
LPCREATESTRUCTA  lpcs 
)
static

Definition at line 436 of file dialog.c.

437{
440 "Edit", "Edit",
442 16,33,184,24, hwnd, (HMENU)101, g_hinst, 0);
443 if (!g_hwndTestDlgEdit) return FALSE;
444
447 "button", "Button &1",
449 204,33,30,24, hwnd, (HMENU)201, g_hinst, 0);
450 if (!g_hwndTestDlgBut1) return FALSE;
451
453 | WS_EX_NOPARENTNOTIFY, "button",
454 "Button &2",
456 90,102,80,24, hwnd, (HMENU)IDCANCEL, g_hinst, 0);
457 if (!g_hwndTestDlgBut2) return FALSE;
458
459 return TRUE;
460}
static HWND g_hwndTestDlgBut1
Definition: dialog.c:50
static HWND g_hwndTestDlgBut2
Definition: dialog.c:50
static HWND g_hwndTestDlgEdit
Definition: dialog.c:50
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
#define ES_AUTOHSCROLL
Definition: pedump.c:672
#define WS_CHILDWINDOW
Definition: pedump.c:639
#define ES_LEFT
Definition: pedump.c:664
#define WS_EX_RIGHTSCROLLBAR
Definition: winuser.h:401
#define WS_EX_LTRREADING
Definition: winuser.h:393
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WS_EX_LEFT
Definition: winuser.h:391

Referenced by testDlgWinProc().

◆ RegisterWindowClasses()

static BOOL RegisterWindowClasses ( void  )
static

Definition at line 608 of file dialog.c.

609{
610 WNDCLASSW cls_w;
611 WNDCLASSA cls;
612
613 cls.style = 0;
615 cls.cbClsExtra = 0;
616 cls.cbWndExtra = 0;
617 cls.hInstance = g_hinst;
618 cls.hIcon = NULL;
620 cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
621 cls.lpszMenuName = NULL;
622 cls.lpszClassName = "GetNextDlgItemWindowClass";
623
624 if (!RegisterClassA (&cls)) return FALSE;
625
627 cls.lpszClassName = "IsDialogMessageWindowClass";
628 if (!RegisterClassA (&cls)) return FALSE;
629
631 cls.lpszClassName = "TESTCONTROL";
632 if (!RegisterClassA (&cls)) return FALSE;
633
634 GetClassInfoA(0, "#32770", &cls);
636 cls.lpszClassName = "WM_NEXTDLGCTLWndClass";
637 if (!RegisterClassA (&cls)) return FALSE;
638
639 memset (&cls_w, 0, sizeof(cls_w));
641 cls_w.hInstance = g_hinst;
642 cls_w.lpszClassName = L"TestIsDialogMessageAClass";
643 if (!RegisterClassW (&cls_w)) return FALSE;
644 return TRUE;
645}
#define L(x)
Definition: resources.c:13
static LRESULT CALLBACK test_IsDialogMessageA_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:582
static LRESULT CALLBACK testDlgWinProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:530
static LRESULT CALLBACK test_control_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:551
static LRESULT CALLBACK main_window_procA(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:462
#define memset(x, y, z)
Definition: compat.h:39
HBRUSH hbrBackground
Definition: winuser.h:3278
HICON hIcon
Definition: winuser.h:3276
HINSTANCE hInstance
Definition: winuser.h:3275
HCURSOR hCursor
Definition: winuser.h:3277
int cbWndExtra
Definition: winuser.h:3274
UINT style
Definition: winuser.h:3271
LPCSTR lpszMenuName
Definition: winuser.h:3279
LPCSTR lpszClassName
Definition: winuser.h:3280
WNDPROC lpfnWndProc
Definition: winuser.h:3272
int cbClsExtra
Definition: winuser.h:3273
LPCWSTR lpszClassName
Definition: winuser.h:3293
HINSTANCE hInstance
Definition: winuser.h:3288
WNDPROC lpfnWndProc
Definition: winuser.h:3285
#define COLOR_WINDOW
Definition: winuser.h:929
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define IDC_ARROW
Definition: winuser.h:695
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
BOOL WINAPI GetClassInfoA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSA)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2459
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dialog  )

Definition at line 2441 of file dialog.c.

2442{
2444
2445 if (!RegisterWindowClasses()) assert(0);
2446
2451 test_focus();
2462}
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static void test_MessageBox(void)
Definition: dialog.c:2255
static void test_WM_NEXTDLGCTL(void)
Definition: dialog.c:647
static void test_IsDialogMessage(void)
Definition: dialog.c:773
static void test_dialog_custom_data(void)
Definition: dialog.c:2295
static void test_focus(void)
Definition: dialog.c:1028
static void test_GetDlgItemText(void)
Definition: dialog.c:1220
static void test_GetNextDlgItem(void)
Definition: dialog.c:348
static void test_SaveRestoreFocus(void)
Definition: dialog.c:2071
static void test_GetDlgItem(void)
Definition: dialog.c:1270
static void test_capture_release(void)
Definition: dialog.c:2343
static void test_DialogBoxParam(void)
Definition: dialog.c:1890
static void test_MessageBoxFontTest(void)
Definition: dialog.c:1982
static void test_create_controls(void)
Definition: dialog.c:2409
static void test_timer_message(void)
Definition: dialog.c:2196
static BOOL RegisterWindowClasses(void)
Definition: dialog.c:608
static void test_DisabledDialogTest(void)
Definition: dialog.c:1964

◆ test_aw_conversion_dlgproc()

static INT_PTR CALLBACK test_aw_conversion_dlgproc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1594 of file dialog.c.

1595{
1596 ULONG_PTR dlgproc, originalproc;
1597 WCHAR buffW[64];
1598 char buff[64];
1599 BOOL ret;
1600 INT len;
1601
1602 switch (msg)
1603 {
1604 case WM_INITDIALOG:
1605 ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1606
1614
1615 /* WM_SETTEXT/WM_GETTEXT */
1616 originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1617 ok(originalproc == (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#Ix.\n", originalproc);
1618
1619 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1620 ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#Ix.\n", dlgproc);
1621
1623 ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1624
1625 dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1626 ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#Ix.\n", dlgproc);
1627
1628 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1629 ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#Ix.\n", dlgproc);
1630
1631 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1632 ret = SetWindowTextA(hdlg, testtext);
1633 todo_wine
1634 ok(ret, "Failed to set window text.\n");
1635
1636 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1637 ret = SetWindowTextW(hdlg, testtextW);
1638 todo_wine
1639 ok(ret, "Failed to set window text.\n");
1640
1641 memset(buff, 'A', sizeof(buff));
1642 len = GetWindowTextA(hdlg, buff, sizeof(buff));
1643 ok(buff[0] == 0 && buff[1] == 'A' && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1644 (BYTE)buff[0], (BYTE)buff[1], len);
1645
1646 memset(buffW, 0xff, sizeof(buffW));
1647 len = GetWindowTextW(hdlg, buffW, 64);
1648 ok(!lstrcmpW(buffW, testtextW) && len == 0, "Unexpected window text %s, len %d\n", wine_dbgstr_w(buffW), len);
1649
1657
1659 ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1660
1661 dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1662 ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#Ix.\n", dlgproc);
1663
1664 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1665 ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#Ix.\n", dlgproc);
1666
1667 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1668 ret = SetWindowTextA(hdlg, testtext);
1669 todo_wine
1670 ok(ret, "Failed to set window text.\n");
1671
1672 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1673 ret = SetWindowTextW(hdlg, testtextW);
1674 todo_wine
1675 ok(ret, "Failed to set window text.\n");
1676
1677 memset(buff, 'A', sizeof(buff));
1678 len = GetWindowTextA(hdlg, buff, sizeof(buff));
1679 ok(buff[0] == 0 && buff[1] == 'A' && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1680 (BYTE)buff[0], (BYTE)buff[1], len);
1681
1682 memset(buffW, 0xff, sizeof(buffW));
1683 len = GetWindowTextW(hdlg, buffW, ARRAY_SIZE(buffW));
1684 ok(buffW[0] == 'W' && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1685 buffW[0], buffW[1], len);
1686
1694
1695 SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
1696 EndDialog(hdlg, -123);
1697 return TRUE;
1698 }
1699 return FALSE;
1700}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4152
static unsigned char buff[32768]
Definition: fatten.c:17
GLenum GLsizei len
Definition: glext.h:6722
#define wine_dbgstr_w
Definition: kernel32.h:34
#define todo_wine
Definition: minitest.h:80
static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1531
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1579
static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1594
static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1481
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
#define LB_ADDFILE
Definition: winuser.h:2059
#define SetWindowLongPtrA
Definition: winuser.h:5511
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define DWLP_DLGPROC
Definition: winuser.h:882
#define LB_DIR
Definition: winuser.h:2062
#define WM_WININICHANGE
Definition: winuser.h:1658
#define EM_REPLACESEL
Definition: winuser.h:2035
#define WM_DEVMODECHANGE
Definition: winuser.h:1659
#define CB_DIR
Definition: winuser.h:1967
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define WM_SETTEXT
Definition: winuser.h:1645
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define SetWindowLongPtrW
Definition: winuser.h:5512
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193

Referenced by test_aw_conversion_dlgproc(), and test_DialogBoxParam().

◆ test_aw_conversion_dlgproc2()

static INT_PTR CALLBACK test_aw_conversion_dlgproc2 ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1702 of file dialog.c.

1703{
1704 ULONG_PTR dlgproc, originalproc;
1705 WCHAR buffW[64];
1706 char buff[64];
1707 BOOL ret;
1708 INT len;
1709
1710 switch (msg)
1711 {
1712 case WM_INITDIALOG:
1713 ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1714
1722
1723 originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1724 ok(originalproc != (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#Ix.\n", originalproc);
1725
1726 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1727 ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#Ix.\n", dlgproc);
1728
1730 ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1731
1732 dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1733 ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#Ix.\n", dlgproc);
1734
1735 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1736 ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#Ix.\n", dlgproc);
1737
1738 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1739 ret = SetWindowTextA(hdlg, testtext);
1740 todo_wine
1741 ok(ret, "Failed to set window text.\n");
1742
1743 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1744 ret = SetWindowTextW(hdlg, testtextW);
1745 todo_wine
1746 ok(ret, "Failed to set window text.\n");
1747
1748 memset(buff, 'A', sizeof(buff));
1749 len = GetWindowTextA(hdlg, buff, sizeof(buff));
1750 ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
1751
1752 memset(buffW, 0xff, sizeof(buffW));
1753 len = GetWindowTextW(hdlg, buffW, 64);
1754 ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %s, len %d\n",
1755 wine_dbgstr_w(buffW), len);
1756
1764
1766 ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1767
1768 dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1769 ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#Ix.\n", dlgproc);
1770
1771 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1772 ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#Ix.\n", dlgproc);
1773
1774 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1775 ret = SetWindowTextA(hdlg, testtext);
1776 todo_wine
1777 ok(ret, "Failed to set window text.\n");
1778
1779 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1780 ret = SetWindowTextW(hdlg, testtextW);
1781 todo_wine
1782 ok(ret, "Failed to set window text.\n");
1783
1784 memset(buff, 'A', sizeof(buff));
1785 len = GetWindowTextA(hdlg, buff, sizeof(buff));
1786 ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
1787
1788 memset(buffW, 0xff, sizeof(buffW));
1789 len = GetWindowTextW(hdlg, buffW, ARRAY_SIZE(buffW));
1790 ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1791 buffW[0], buffW[1], len);
1792
1800
1801 SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
1802 EndDialog(hdlg, -123);
1803 return TRUE;
1804 }
1805 return FALSE;
1806}
static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1702

Referenced by test_aw_conversion_dlgproc2(), and test_DialogBoxParam().

◆ test_aw_conversion_dlgproc3()

static INT_PTR CALLBACK test_aw_conversion_dlgproc3 ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1850 of file dialog.c.

1851{
1852 BOOL is_unicode = !!lparam;
1853 LONG_PTR oldproc;
1854
1855 switch (msg)
1856 {
1857 case WM_INITDIALOG:
1858 ok(is_unicode == IsWindowUnicode(hdlg), "Unexpected unicode window property.\n");
1859
1861 SetWindowLongPtrA(hdlg, GWLP_USERDATA, oldproc);
1862 ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1863
1871
1873 ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1874
1882
1883 SetWindowLongPtrA(hdlg, GWLP_WNDPROC, oldproc);
1884 EndDialog(hdlg, -123);
1885 return TRUE;
1886 }
1887 return FALSE;
1888}
static LRESULT CALLBACK test_aw_conversion_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1808
#define GWLP_WNDPROC
Definition: treelist.c:66
#define GWLP_USERDATA
Definition: treelist.c:63

Referenced by test_DialogBoxParam().

◆ test_aw_conversion_dlgprocA()

static INT_PTR CALLBACK test_aw_conversion_dlgprocA ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1481 of file dialog.c.

1482{
1483 int mode = HandleToULong(GetPropA(hdlg, "test_mode"));
1484 WCHAR *text = (WCHAR *)lparam;
1485 char *textA = (char *)lparam;
1486
1487 switch (msg)
1488 {
1489 case WM_SETTEXT:
1490 case WM_WININICHANGE:
1491 case WM_DEVMODECHANGE:
1492 case CB_DIR:
1493 case LB_DIR:
1494 case LB_ADDFILE:
1495 case EM_REPLACESEL:
1496 switch (mode)
1497 {
1499 ok(textA == testtext, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A",
1500 testmodes[mode], textA);
1501 break;
1503 ok(text == testtextW, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A", testmodes[mode],
1505 break;
1508 if (IsWindowUnicode(hdlg))
1509 {
1511 "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1512 }
1513 else
1514 ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1515 break;
1518 if (IsWindowUnicode(hdlg))
1519 ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1520 else
1521 ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1522 testmodes[mode], textA);
1523 break;
1524 }
1525 break;
1526 };
1527
1528 return DefWindowProcW(hdlg, msg, wparam, lparam);
1529}
@ wparam
Definition: SystemMenu.c:30
#define HandleToULong(h)
Definition: basetsd.h:89
GLenum mode
Definition: glext.h:6217
static const char textA[]
Definition: registrar.c:40
static const char * testmodes[]
Definition: dialog.c:1471
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_aw_conversion_dlgproc(), and test_aw_conversion_dlgproc2().

◆ test_aw_conversion_dlgprocW()

static INT_PTR CALLBACK test_aw_conversion_dlgprocW ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1531 of file dialog.c.

1532{
1533 int mode = HandleToULong(GetPropA(hdlg, "test_mode"));
1534 WCHAR *text = (WCHAR *)lparam;
1535 char *textA = (char *)lparam;
1536
1537 switch (msg)
1538 {
1539 case WM_SETTEXT:
1540 case WM_WININICHANGE:
1541 case WM_DEVMODECHANGE:
1542 case CB_DIR:
1543 case LB_DIR:
1544 case LB_ADDFILE:
1545 case EM_REPLACESEL:
1546 switch (mode)
1547 {
1549 ok(textA == testtext, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A",
1550 testmodes[mode], textA);
1551 break;
1553 ok(text == testtextW, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A", testmodes[mode],
1555 break;
1558 if (IsWindowUnicode(hdlg))
1560 "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1561 else
1562 ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1563 break;
1566 if (IsWindowUnicode(hdlg))
1567 ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1568 else
1569 ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1570 testmodes[mode], textA);
1571 break;
1572 }
1573 break;
1574 }
1575
1576 return DefWindowProcA(hdlg, msg, wparam, lparam);
1577}

Referenced by test_aw_conversion_dlgproc(), and test_aw_conversion_dlgproc2().

◆ test_aw_conversion_wndproc()

static LRESULT CALLBACK test_aw_conversion_wndproc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1808 of file dialog.c.

1809{
1811 int mode = HandleToULong(GetPropA(hwnd, "test_mode"));
1812 WCHAR *text = (WCHAR *)lparam;
1813 char *textA = (char *)lparam;
1814
1815 switch (msg)
1816 {
1817 case WM_SETTEXT:
1818 case WM_WININICHANGE:
1819 case WM_DEVMODECHANGE:
1820 case CB_DIR:
1821 case LB_DIR:
1822 case LB_ADDFILE:
1823 case EM_REPLACESEL:
1824 switch (mode)
1825 {
1827 if (IsWindowUnicode(hwnd))
1829 "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1830 else
1831 ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1832 break;
1834 if (IsWindowUnicode(hwnd))
1835 ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1836 else
1837 ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1838 testmodes[mode], textA);
1839 break;
1840 default:
1841 ok(0, "Unexpected test mode %d.\n", mode);
1842 }
1843 break;
1844 }
1845
1846 return IsWindowUnicode(hwnd) ? CallWindowProcW(oldproc, hwnd, msg, wparam, lparam) :
1847 CallWindowProcA(oldproc, hwnd, msg, wparam, lparam);
1848}
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by test_aw_conversion_dlgproc3().

◆ test_capture_release()

static void test_capture_release ( void  )
static

Definition at line 2343 of file dialog.c.

2344{
2346 INT_PTR ret;
2347 MSG msg;
2348
2349 /* Set the capture to a child window. The main window will receive
2350 * WM_CANCELMODE when being disabled, but the child window will retain
2351 * capture. */
2352
2353 window = CreateWindowA("static", "parent", 0, 100, 200, 300, 400, NULL, NULL, NULL, NULL);
2354 child = CreateWindowA("static", "child", WS_CHILD, 10, 20, 100, 100, window, NULL, NULL, NULL);
2355
2358 ok(ret == 1, "got %#Ix\n", ret);
2359 ok(!GetCapture(), "got capture %p\n", GetCapture());
2360
2363 ok(ret == 1, "got %#Ix\n", ret);
2364 ok(!GetCapture(), "got capture %p\n", GetCapture());
2365
2367 dialog = CreateDialogParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG",
2369 ok(!!dialog, "failed to create dialog\n");
2370 ok(GetCapture() == child, "got capture %p\n", GetCapture());
2372 ok(GetCapture() == child, "got capture %p\n", GetCapture());
2373 while (GetMessageA(&msg, NULL, 0, 0))
2375 ok(GetCapture() == child, "got capture %p\n", GetCapture());
2376
2378
2381}
static IHTMLWindow2 * window
Definition: events.c:77
static INT_PTR CALLBACK capture_release_proc(HWND dialog, UINT message, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:2300
static INT_PTR CALLBACK capture_release_modeless_proc(HWND dialog, UINT message, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:2327
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT_PTR
Definition: typedefs.h:64
#define SW_SHOWNORMAL
Definition: winuser.h:781
HWND WINAPI SetCapture(_In_ HWND hWnd)
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
HWND WINAPI CreateDialogParamA(_In_opt_ HINSTANCE, _In_ LPCSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI GetMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
INT_PTR WINAPI DialogBoxParamA(_In_opt_ HINSTANCE, _In_ LPCSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by START_TEST().

◆ test_control_procA()

static LRESULT CALLBACK test_control_procA ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 551 of file dialog.c.

552{
553 switch(msg)
554 {
555 case WM_CREATE:
556 {
557 static const short sample[] = { 10,1,2,3,4,5 };
559 short *data = cs->lpCreateParams;
560 ok(!memcmp(data, sample, sizeof(sample)), "data mismatch: %d,%d,%d,%d,%d\n", data[0], data[1], data[2], data[3], data[4]);
561 }
562 return 0;
563
564 default:
565 break;
566 }
567
569}
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define cs
Definition: i386-dis.c:442

Referenced by RegisterWindowClasses().

◆ test_create_controls()

static void test_create_controls ( void  )
static

Definition at line 2409 of file dialog.c.

2410{
2411 HWND control;
2412 INT_PTR ret;
2413
2414 control = CreateWindowA("static", "", 0, 100, 200, 300, 400, NULL, NULL, NULL, NULL);
2415 ok(control != 0, "failed to create control window\n");
2416
2418
2419 cs_name_paramW[0] = 0;
2420 ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_SS_ICON_DIALOG", 0, DestroyOnCloseDlgWinProc, 0);
2421 ok(0 == ret, "DialogBoxParamA returned %Id, expected 0\n", ret);
2422 ok(!memcmp(cs_name_paramA, "\xff\0\x61", 3), "name param = %s\n", debugstr_an(cs_name_paramA, 3));
2423
2426
2427 control = CreateWindowW(L"static", L"", 0, 100, 200, 300, 400, NULL, NULL, NULL, NULL);
2428 ok(control != 0, "failed to create control window\n");
2429
2431
2432 ret = DialogBoxParamW(GetModuleHandleW(NULL), L"IDD_SS_ICON_DIALOG", 0, DestroyOnCloseDlgWinProc, 0);
2433 ok(0 == ret, "DialogBoxParamW returned %Id, expected 0\n", ret);
2434 ok(!memcmp(cs_name_paramW, L"\xffff\x6100", 2 * sizeof(WCHAR)),
2435 "name param = %s\n", debugstr_wn(cs_name_paramW, 2));
2436
2439}
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define debugstr_wn
Definition: kernel32.h:33
static LRESULT WINAPI test_static_create_procW(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:2387
static WCHAR cs_name_paramW[3]
Definition: dialog.c:2384
static INT_PTR CALLBACK DestroyOnCloseDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1336
static char cs_name_paramA[4]
Definition: dialog.c:2385
static LRESULT WINAPI test_static_create_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:2398
static WNDPROC orig_static_proc
Definition: dialog.c:2383
Definition: dialog.c:52
#define SetClassLongPtrW
Definition: winuser.h:5431
#define SetClassLongPtrA
Definition: winuser.h:5430
#define GCLP_WNDPROC
Definition: winuser.h:686
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4470
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by START_TEST().

◆ test_dialog_custom_data()

static void test_dialog_custom_data ( void  )
static

Definition at line 2295 of file dialog.c.

2296{
2297 DialogBoxA(g_hinst, "CUSTOM_TEST_DIALOG", NULL, custom_test_dialog_proc);
2298}
static INT_PTR CALLBACK custom_test_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:2287
#define DialogBoxA(i, t, p, f)
Definition: winuser.h:4552

Referenced by START_TEST().

◆ test_DialogBoxParam()

static void test_DialogBoxParam ( void  )
static

Definition at line 1890 of file dialog.c.

1891{
1892 static const WCHAR nameW[] = {'T','E','S','T','_','E','M','P','T','Y','_','D','I','A','L','O','G',0};
1893 INT_PTR ret;
1894 HWND hwnd_invalid = (HWND)0x4444;
1895
1896 ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DLG_CHILD_POPUP", 0, TestControlStyleDlgProc, 0);
1897 ok(ret == -7, "expected -7, got %Id\n", ret);
1898
1899 SetLastError(0xdeadbeef);
1900 ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_DIALOG" , hwnd_invalid, 0 , 0);
1901 ok(0 == ret || broken(ret == -1), "DialogBoxParamA returned %Id, expected 0\n", ret);
1903 broken(GetLastError() == 0xdeadbeef),
1904 "got %ld, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
1905
1906 /* Test a dialog which destroys itself on WM_INITDIALOG. */
1907 SetLastError(0xdeadbeef);
1909 ok(-1 == ret, "DialogBoxParamA returned %Id, expected -1\n", ret);
1912 broken(GetLastError() == 0xdeadbeef),
1913 "got %ld, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
1914
1915 /* Test a dialog which destroys itself on WM_CLOSE. */
1917 ok(0 == ret, "DialogBoxParamA returned %Id, expected 0\n", ret);
1918
1919 SetLastError(0xdeadbeef);
1920 ret = DialogBoxParamA(GetModuleHandleA(NULL), "RESOURCE_INVALID" , 0, 0, 0);
1921 ok(-1 == ret, "DialogBoxParamA returned %Id, expected -1\n", ret);
1923 broken(GetLastError() == 0xdeadbeef),
1924 "got %ld, expected ERROR_RESOURCE_NAME_NOT_FOUND\n",GetLastError());
1925
1926 SetLastError(0xdeadbeef);
1927 ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DIALOG_INVALID_CLASS", 0, DestroyDlgWinProc, 0);
1928 ok(ret == -1, "DialogBoxParamA returned %Id, expected -1\n", ret);
1929 todo_wine
1931 broken(GetLastError() == ERROR_SUCCESS) /* < win10 21H1 */,
1932 "got %lu, expected ERROR_CANNOT_FIND_WND_CLASS\n", GetLastError());
1933
1934 SetLastError(0xdeadbeef);
1935 ret = DefDlgProcA(0, WM_ERASEBKGND, 0, 0);
1936 ok(ret == 0, "DefDlgProcA returned %Id, expected 0\n", ret);
1938 broken(GetLastError() == 0xdeadbeef),
1939 "got %ld, expected ERROR_INVALID_WINDOW_HANDLE\n", GetLastError());
1940
1941 ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestInitDialogHandleProc, 0);
1942 ok(ret == IDOK, "Expected IDOK\n");
1943
1944 ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestDefButtonDlgProc, 0);
1945 ok(ret == IDOK, "Expected IDOK\n");
1946
1947 ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestReturnKeyDlgProc, 0);
1948 ok(ret == 0, "Unexpected ret value %Id.\n", ret);
1949
1950 /* WM_SETTEXT handling in case of A/W dialog procedures vs A/W dialog window. */
1952 ok(ret == -123, "Unexpected ret value %Id.\n", ret);
1953
1955 ok(ret == -123, "Unexpected ret value %Id.\n", ret);
1956
1958 ok(ret == -123, "Unexpected ret value %Id.\n", ret);
1959
1961 ok(ret == -123, "Unexpected ret value %Id.\n", ret);
1962}
static const WCHAR nameW[]
Definition: main.c:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define SetLastError(x)
Definition: compat.h:752
static INT_PTR CALLBACK TestDefButtonDlgProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1370
static INT_PTR CALLBACK TestControlStyleDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1422
static INT_PTR CALLBACK DestroyDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1325
static INT_PTR CALLBACK TestInitDialogHandleProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1354
static INT_PTR CALLBACK test_aw_conversion_dlgproc3(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1850
static INT_PTR CALLBACK TestReturnKeyDlgProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1382
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:1226
#define ERROR_RESOURCE_NAME_NOT_FOUND
Definition: winerror.h:1478
#define ERROR_CANNOT_FIND_WND_CLASS
Definition: winerror.h:1233
#define WM_ERASEBKGND
Definition: winuser.h:1653

Referenced by START_TEST().

◆ test_DisabledDialogTest()

static void test_DisabledDialogTest ( void  )
static

Definition at line 1964 of file dialog.c.

1965{
1967 DialogBoxParamA(g_hinst, "IDD_DIALOG", NULL, disabled_test_proc, 0);
1968 ok(FALSE == g_terminated, "dialog with disabled ok button has been terminated\n");
1969}
static INT_PTR CALLBACK disabled_test_proc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:492

Referenced by START_TEST().

◆ test_focus()

static void test_focus ( void  )
static

Definition at line 1028 of file dialog.c.

1029{
1030 /* Test 1:
1031 * This test intentionally returns FALSE in response to WM_INITDIALOG
1032 * without setting focus to a control. This is what MFC's CFormView does.
1033 *
1034 * Since the WM_INITDIALOG handler returns FALSE without setting the focus,
1035 * the focus should initially be NULL. Later, when we manually set focus to
1036 * the dialog, the default handler should set focus to the first control that
1037 * is "visible, not disabled, and has the WS_TABSTOP style" (MSDN). Because the
1038 * second radio button has been checked, it should be the first control
1039 * that meets these criteria and should receive the focus.
1040 */
1041
1047
1048 DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);
1049
1051 "Error in wrc - Detected WS_TABSTOP as default style for GROUPBOX\n");
1052
1054 "Modal dialogs should not be shown until the message queue first goes empty\n");
1055
1057 "Error in initial focus when WM_INITDIALOG returned FALSE: "
1058 "Expected NULL focus, got %s (%p).\n",
1060
1062 "Error after first SetFocus() when WM_INITDIALOG returned FALSE: "
1063 "Expected the second button (%p), got %s (%p).\n",
1066
1067 /* Test 2:
1068 * This is the same as above, except WM_INITDIALOG is made to return TRUE.
1069 * This should cause the focus to go to the second radio button right away
1070 * and stay there (until the user indicates otherwise).
1071 */
1072
1078
1079 DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);
1080
1082 "Error in initial focus when WM_INITDIALOG returned TRUE: "
1083 "Expected the second button (%p), got %s (%p).\n",
1086
1088 "Error after first SetFocus() when WM_INITDIALOG returned TRUE: "
1089 "Expected the second button (%p), got %s (%p).\n",
1092
1093 /* Test 3:
1094 * If the dialog has DS_CONTROL and it's not visible then we shouldn't change focus */
1095 {
1096 HWND hDlg;
1097 HRSRC hResource;
1098 HANDLE hTemplate;
1099 DLGTEMPLATE* pTemplate;
1100 HWND hTextbox;
1101 DWORD selectionStart = 0xdead, selectionEnd = 0xbeef;
1102
1103 hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG", (LPCSTR)RT_DIALOG);
1104 hTemplate = LoadResource(g_hinst, hResource);
1105 pTemplate = LockResource(hTemplate);
1106
1109 ok (hDlg != 0, "Failed to create test dialog.\n");
1110
1111 ok ((g_hwndInitialFocusT1 == 0),
1112 "Focus should not be set for an invisible DS_CONTROL dialog %p.\n", g_hwndInitialFocusT1);
1113
1114 /* Also make sure that WM_SETFOCUS selects the textbox's text */
1115 hTextbox = GetDlgItem(hDlg, 200);
1116 SendMessageA(hTextbox, WM_SETTEXT, 0, (LPARAM)"Hello world");
1117
1118 SendMessageA(hDlg, WM_SETFOCUS, 0, 0);
1119 SendMessageA(hTextbox, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
1120 ok(selectionStart == 0 && selectionEnd == 11, "Text selection after WM_SETFOCUS is [%li, %li) expected [0, 11)\n", selectionStart, selectionEnd);
1121
1122 /* but WM_ACTIVATE does not */
1123 SendMessageA(hTextbox, EM_SETSEL, 0, 0);
1125 SendMessageA(hTextbox, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
1126 ok(selectionStart == 0 && selectionEnd == 0, "Text selection after WM_ACTIVATE is [%li, %li) expected [0, 0)\n", selectionStart, selectionEnd);
1127
1128 DestroyWindow(hDlg);
1129 }
1130
1131 /* Test 4:
1132 * If the dialog has no tab-accessible controls, set focus to first control */
1133 {
1134 HWND hDlg;
1135 HRSRC hResource;
1136 HANDLE hTemplate;
1137 DLGTEMPLATE* pTemplate;
1138 HWND hLabel;
1139
1140 hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_2", (LPCSTR)RT_DIALOG);
1141 hTemplate = LoadResource(g_hinst, hResource);
1142 pTemplate = LockResource(hTemplate);
1143
1145 ok(hDlg != 0, "Failed to create test dialog.\n");
1146 hLabel = GetDlgItem(hDlg, 200);
1147
1148 ok(GetFocus() == hLabel, "Focus not set to label, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1149
1150 DestroyWindow(hDlg);
1151
1152 /* Also check focus after WM_ACTIVATE and WM_SETFOCUS */
1153 hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, NULL, 0);
1154 ok(hDlg != 0, "Failed to create test dialog.\n");
1155 hLabel = GetDlgItem(hDlg, 200);
1156
1157 SetFocus(NULL);
1159 ok(GetFocus() == NULL, "Focus set on WM_ACTIVATE, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1160
1161 SetFocus(NULL);
1162 SendMessageA(hDlg, WM_SETFOCUS, 0, 0);
1163 ok(GetFocus() == hLabel, "Focus not set to label on WM_SETFOCUS, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1164
1165 DestroyWindow(hDlg);
1166 }
1167
1168 /* Test 5:
1169 * Select textbox's text on creation */
1170 {
1171 HWND hDlg;
1172 HRSRC hResource;
1173 HANDLE hTemplate;
1174 DLGTEMPLATE* pTemplate;
1175 HWND edit;
1176 DWORD selectionStart = 0xdead, selectionEnd = 0xbeef;
1177
1178 hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_3", (LPCSTR)RT_DIALOG);
1179 hTemplate = LoadResource(g_hinst, hResource);
1180 pTemplate = LockResource(hTemplate);
1181
1183 ok(hDlg != 0, "Failed to create test dialog.\n");
1184 edit = GetDlgItem(hDlg, 200);
1185
1186 ok(GetFocus() == edit, "Focus not set to edit, focus=%p, dialog=%p, edit=%p\n",
1187 GetFocus(), hDlg, edit);
1188 SendMessageA(edit, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
1189 ok(selectionStart == 0 && selectionEnd == 11,
1190 "Text selection after WM_SETFOCUS is [%li, %li) expected [0, 11)\n",
1191 selectionStart, selectionEnd);
1192
1193 DestroyWindow(hDlg);
1194 }
1195
1196 /* Test 6:
1197 * Select textbox's text on creation when WM_INITDIALOG creates a child dialog. */
1198 {
1199 HWND hDlg;
1200 HRSRC hResource;
1201 HANDLE hTemplate;
1202 DLGTEMPLATE* pTemplate;
1203 HWND edit;
1204
1205 hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_3", (LPCSTR)RT_DIALOG);
1206 hTemplate = LoadResource(g_hinst, hResource);
1207 pTemplate = LockResource(hTemplate);
1208
1210 ok(hDlg != 0, "Failed to create test dialog.\n");
1211 edit = GetDlgItem(hDlg, 200);
1212
1213 ok(GetFocus() == edit, "Focus not set to edit, focus=%p, dialog=%p, edit=%p\n",
1214 GetFocus(), hDlg, edit);
1215
1216 DestroyWindow(hDlg);
1217 }
1218}
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
UINT_PTR WPARAM
Definition: minwindef.h:174
static INT_PTR CALLBACK focusChildDlgWinProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:968
static INT_PTR CALLBACK delayFocusDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:898
static INT_PTR CALLBACK focusDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:938
static const char * GetHwndString(HWND hw)
Definition: dialog.c:1010
#define RT_DIALOG
Definition: pedump.c:367
#define EM_GETSEL
Definition: winuser.h:2026
#define WM_SETFOCUS
Definition: winuser.h:1641
#define WM_ACTIVATE
Definition: winuser.h:1640
#define EM_SETSEL
Definition: winuser.h:2047
#define WA_ACTIVE
Definition: winuser.h:2665

Referenced by START_TEST().

◆ test_GetDlgItem()

static void test_GetDlgItem ( void  )
static

Definition at line 1270 of file dialog.c.

1271{
1272 HWND hwnd, child1, child2, hwnd2;
1274 BOOL ret;
1275
1276 hwnd = CreateWindowA("button", "parent", WS_VISIBLE, 0, 0, 100, 100, NULL, 0, g_hinst, NULL);
1277 ok(hwnd != NULL, "failed to created window\n");
1278
1279 /* created with the same ID */
1280 child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
1281 ok(child1 != NULL, "failed to create first child\n");
1282 child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
1283 ok(child2 != NULL, "failed to create second child\n");
1284
1285 hwnd2 = GetDlgItem(hwnd, 0);
1286 ok(hwnd2 == child1, "expected first child, got %p\n", hwnd2);
1287
1288 hwnd2 = GetTopWindow(hwnd);
1289 ok(hwnd2 == child1, "expected first child to be top, got %p\n", hwnd2);
1290
1291 ret = SetWindowPos(child1, child2, 0, 0, 0, 0, SWP_NOMOVE);
1292 ok(ret, "got %d\n", ret);
1293 hwnd2 = GetTopWindow(hwnd);
1294 ok(hwnd2 == child2, "expected second child to be top, got %p\n", hwnd2);
1295
1296 /* top window from child list is picked */
1297 hwnd2 = GetDlgItem(hwnd, 0);
1298 ok(hwnd2 == child2, "expected second child, got %p\n", hwnd2);
1299
1300 /* Now test how GetDlgItem searches */
1301 DestroyWindow(child2);
1302 child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, child1, 0, g_hinst, NULL);
1303 ok(child2 != NULL, "failed to create second child\n");
1304
1305 /* give child2 an ID */
1306 SetWindowLongA(child2, GWLP_ID, 100);
1307
1308 hwnd2 = GetDlgItem(hwnd, 100);
1309 ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);
1310
1311 /* make the ID of child2 public with a WS_EX_CONTROLPARENT parent */
1313
1314 hwnd2 = GetDlgItem(hwnd, 100);
1315 ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);
1316
1317 DestroyWindow(child1);
1318 DestroyWindow(child2);
1320
1321 retval = DialogBoxParamA(g_hinst, "GETDLGITEM_TEST_DIALOG", NULL, getdlgitem_test_dialog_proc, 0);
1322 ok(retval == 0xdead, "Unexpected return value.\n");
1323}
static INT_PTR CALLBACK getdlgitem_test_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1233
int retval
Definition: wcstombs.cpp:91
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1255
HWND WINAPI GetTopWindow(_In_opt_ HWND)

Referenced by START_TEST().

◆ test_GetDlgItemText()

static void test_GetDlgItemText ( void  )
static

Definition at line 1220 of file dialog.c.

1221{
1222 char string[64];
1223 BOOL ret;
1224
1225 strcpy(string, "Overwrite Me");
1226 ret = GetDlgItemTextA(NULL, 0, string, ARRAY_SIZE(string));
1227 ok(!ret, "GetDlgItemText(NULL) shouldn't have succeeded\n");
1228
1229 ok(string[0] == '\0' || broken(!strcmp(string, "Overwrite Me")),
1230 "string retrieved using GetDlgItemText should have been NULL terminated\n");
1231}
strcpy
Definition: string.h:131

Referenced by START_TEST().

◆ test_GetNextDlgItem()

static void test_GetNextDlgItem ( void  )
static

Definition at line 348 of file dialog.c.

349{
350 static test_record test [] =
351 {
352 /* isok test dlg ctl tab prev res */
353
354 { 1, 1, 6, 0, 0, 1, 0},
355 { 1, 2, 6, 0, 1, 1, 0},
356 { 1, 3, 6, 6, 0, 1, 0},
357 { 1, 4, 6, 6, 1, 1, 0},
358 { 1, 5, 6, 0, 0, 0, 66},
359 { 1, 6, 6, 0, 1, 0, 67},
360 { 1, 7, 6, 6, 0, 0, 66},
361 { 1, 8, 6, 6, 1, 0, 67},
362
363 { 1, 9, 4, 83, 1, 0, 84},
364 { 1, 10, 4, 83, 0, 0, 5},
365 { 1, 11, 5, 81, 1, 0, 67},
366 { 1, 12, 5, 81, 0, 0, 66},
367 { 1, 13, 5, 82, 1, 1, 78},
368
369 { 1, 14, 5, 82, 0, 1, 79},
370 { 1, 15, 6, 70, 0, 0, 72},
371 { 1, 16, 6, 72, 0, 0, 25},
372 { 1, 17, 6, 75, 0, 0, 26},
373 { 1, 18, 6, 77, 0, 0, 76},
374 { 1, 19, 6, 79, 0, 0, 66},
375 { 1, 20, 6, 71, 0, 0, 72},
376 { 1, 21, 6, 64, 0, 0, 66},
377
378 { 1, 22, 6, 25, 0, 0, 70},
379 { 1, 23, 6, 68, 0, 0, 68},
380 { 1, 24, 6, 25, 0, 1, 72},
381 { 1, 25, 1, 70, 0, 0, 72},
382 /*{ 0, 26, 1, 70, 0, 1, 3}, Crashes Win95*/
383 { 1, 27, 1, 70, 1, 0, 72},
384 /*{ 0, 28, 1, 70, 1, 1, 61}, Crashes Win95*/
385
386 { 1, 29, 6, 67, 1, 0, 72},
387 { 1, 30, 6, 72, 1, 1, 67},
388
389 { 1, 35, 2, 0, 0, 0, 60},
390 { 1, 36, 2, 0, 1, 0, 60},
391
392 { 0, 0, 0, 0, 0, 0, 0} /* End of test */
393 };
394 const test_record *p = test;
395
396 ok (CreateWindows (g_hinst), "Could not create test windows\n");
397
398 while (p->dlg)
399 {
400 HWND a;
401 a = (p->tab ? GetNextDlgTabItem : GetNextDlgGroupItem) (hwnd[p->dlg], hwnd[p->ctl], p->prev);
402 todo_wine_if (!p->isok)
403 ok (a == hwnd[p->res], "Test %d: %s %s item of %d in %d was %d instead of %d\n", p->test, p->prev ? "Prev" : "Next", p->tab ? "Tab" : "Group", p->ctl, p->dlg, id(a), p->res);
404 p++;
405 }
406}
@ Group
Definition: help.c:22
GLdouble s
Definition: gl.h:2039
GLdouble n
Definition: glext.h:7729
GLuint res
Definition: glext.h:9613
GLuint in
Definition: glext.h:9616
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define d
Definition: ke_i.h:81
#define a
Definition: ke_i.h:78
static BOOL CreateWindows(HINSTANCE hinst)
Definition: dialog.c:155
#define test
Definition: rosglue.h:37
STDMETHOD() Next(THIS_ ULONG celt, IAssociationElement *pElement, ULONG *pceltFetched) PURE
static struct wctab tab[]
HWND WINAPI GetNextDlgTabItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
HWND WINAPI GetNextDlgGroupItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)

Referenced by START_TEST().

◆ test_IsDialogMessage()

static void test_IsDialogMessage ( void  )
static

Definition at line 773 of file dialog.c.

774{
775 HHOOK hook;
776 HWND child;
777 BOOL ret;
778 MSG msg;
779
780 g_hwndMain = CreateWindowA("IsDialogMessageWindowClass", "IsDialogMessageWindowClass",
783 NULL, NULL, g_hinst, 0);
784
788
789 if (0)
790 {
791 /* crashes on Windows */
794 }
795
796 /* The focus should initially be nowhere. The first TAB should take it
797 * to the first button. The second TAB should take it to the Cancel
798 * button.
799 */
800
801 /* valid window, invalid message window */
803 FormTabMsg (&msg, (HWND)0xbeefbeef);
804 ok (!IsDialogMessageA(g_hwndMain, &msg), "expected failure\n");
805 ok(g_MSGF_DIALOGBOX, "hook wasn't called\n");
808
811
812 ok (!IsDialogMessageA(NULL, &msg), "expected failure\n");
813 ok (!IsDialogMessageA((HWND)0xbeefbeef, &msg), "expected failure\n");
814
816
817 ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle first TAB\n");
818 ok ((GetFocus() == g_hwndButton1), "Focus did not move to first button\n");
820 ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle second TAB\n");
822 "Focus did not move to cancel button\n");
824 ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
825 ok (g_terminated, "ENTER did not terminate\n");
826
827 /* matching but invalid window handles, NULL */
829
830 FormTabMsg (&msg, NULL);
831 ok (!IsDialogMessageA(msg.hwnd, &msg), "expected failure\n");
832
833 /* matching but invalid window handles, not NULL */
834 FormTabMsg (&msg, (HWND)0xbeefbeef);
835 ok (!IsDialogMessageA(msg.hwnd, &msg), "expected failure\n");
836
839
840 g_hwndMain = CreateWindowA("IsDialogMessageWindowClass", "IsDialogMessageWindowClass", WS_OVERLAPPEDWINDOW,
845 ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
846 ok(g_button1Clicked, "Did not receive button 1 click notification\n");
847
850 ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
851 ok(g_button1Clicked, "Did not receive button 1 click notification\n");
852
855 ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
856 ok(g_button1Clicked, "Did not receive button 1 click notification\n");
857
858 /* Button with id larger than 0xFFFF should also work */
862 ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
863 ok(g_button1Clicked, "Did not receive button 1 click notification\n");
864
865 /* Test IsDialogMessageA converting a WM_CHAR wparam in ASCII to Unicode */
866 child = CreateWindowW(L"TestIsDialogMessageAClass", L"test", WS_CHILD | WS_VISIBLE, 0, 0, 10,
867 10, g_hwndMain, 0, g_hinst, 0);
868 ok(!!child, "Failed to create a window, error %#lx.\n", GetLastError());
869
870 /* \u5b57 is a 'å­—' in Chinese */
871 PostMessageW(child, WM_CHAR, 0x5b57, 0x1);
873
874 while (GetMessageA(&msg, child, 0, 0) > 0)
875 {
876 if (msg.message == WM_CHAR)
877 {
878 if (is_cjk())
879 ok(msg.wParam != 0x3f && msg.wParam != 0x5b57, "Got unexpected wparam %#Ix.\n", msg.wParam);
881 ok(msg.wParam == 0x97ade5, "Got unexpected wparam %#Ix.\n", msg.wParam);
882 else
883 ok(msg.wParam == 0x3f, "Got unexpected wparam %#Ix.\n", msg.wParam);
885 ok(ret, "IsDialogMessageA failed.\n");
886 }
887 else
888 {
891 }
892 }
893 ok(wm_char_count == 1, "Got unexpected WM_CHAR count %d.\n", wm_char_count);
895}
@ hook
Definition: SystemMenu.c:35
UINT WINAPI GetACP(void)
Definition: locale.c:2023
static LRESULT CALLBACK hook_proc2(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:766
static LRESULT CALLBACK hook_proc(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:759
static int wm_char_count
Definition: dialog.c:571
static void FormTabMsg(MSG *pMsg, HWND hwnd)
Definition: dialog.c:224
static void FormEnterMsg(MSG *pMsg, HWND hwnd)
Definition: dialog.c:235
static BOOL is_cjk(void)
Definition: dialog.c:573
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define LANG_HINDI
Definition: nls.h:68
#define CP_UTF8
Definition: nls.h:20
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WH_MSGFILTER
Definition: winuser.h:29
HHOOK WINAPI SetWindowsHookExA(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
BOOL WINAPI IsDialogMessageA(_In_ HWND, _In_ LPMSG)
#define WM_CHAR
Definition: winuser.h:1745
#define CW_USEDEFAULT
Definition: winuser.h:225

Referenced by START_TEST().

◆ test_IsDialogMessageA_proc()

static LRESULT CALLBACK test_IsDialogMessageA_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 582 of file dialog.c.

583{
584 switch (msg)
585 {
586 case WM_CHAR:
587 if (is_cjk())
588 ok(wparam == 0x5b57, "Got unexpected wparam %#Ix.\n", wparam);
590 ok(wparam == 0xfffd, "Got unexpected wparam %#Ix.\n", wparam);
591 else
592 ok(wparam == 0x3f, "Got unexpected wparam %#Ix.\n", wparam);
594 return 0;
595 case WM_CLOSE:
597 return 0;
598 case WM_DESTROY:
600 return 0;
601 case WM_GETDLGCODE:
602 return DLGC_WANTCHARS;
603 default:
605 }
606}
#define DLGC_WANTCHARS
Definition: winuser.h:2660
#define WM_GETDLGCODE
Definition: winuser.h:1717

Referenced by RegisterWindowClasses().

◆ test_MessageBox()

static void test_MessageBox ( void  )
static

Definition at line 2255 of file dialog.c.

2256{
2257 static const UINT tests[] =
2258 {
2266 };
2267 unsigned int i;
2268 HHOOK hook;
2269 int ret;
2270
2272
2273 for (i = 0; i < ARRAY_SIZE(tests); ++i)
2274 {
2275 msgbox_type = tests[i];
2278 ret = MessageBoxA(NULL, "Text", "MSGBOX caption", msgbox_type);
2279 ok(ret == IDCANCEL, "got %d\n", ret);
2282 }
2283
2285}
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:537
static struct test_info tests[]
static LRESULT CALLBACK msgbox_hook_proc(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:2204
unsigned int UINT
Definition: ndis.h:50
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
#define WH_CBT
Definition: winuser.h:35

Referenced by START_TEST().

◆ test_MessageBoxFontTest()

static void test_MessageBoxFontTest ( void  )
static

Definition at line 1982 of file dialog.c.

1983{
1984 /* This dialog template defines a dialog template which got 0x7fff as its
1985 * font size and omits the other font members. On WinNT, passing such a
1986 * dialog template to CreateDialogIndirectParamW will result in a dialog
1987 * being created which uses the message box font. We test that here.
1988 */
1989
1990 static unsigned char dlgTemplate[] =
1991 {
1992 /* Dialog header */
1993 0x01,0x00, /* Version */
1994 0xff,0xff, /* Extended template marker */
1995 0x00,0x00,0x00,0x00, /* Context Help ID */
1996 0x00,0x00,0x00,0x00, /* Extended style */
1997 0xc0,0x00,0xc8,0x80, /* Style (WS_SYSMENU|WS_CAPTION|WS_POPUP|DS_SETFONT|DS_MODALFRAME) */
1998 0x01,0x00, /* Control count */
1999 0x00,0x00, /* X */
2000 0x00,0x00, /* Y */
2001 0x80,0x00, /* Width */
2002 0x80,0x00, /* Height */
2003 0x00,0x00, /* Menu name */
2004 0x00,0x00, /* Class name */
2005 'T',0x00,'e',0x00, /* Caption (unicode) */
2006 's',0x00,'t',0x00,
2007 0x00,0x00,
2008 0xff,0x7f, /* Font height (0x7fff = message box font) */
2009
2010 /* Control #1 */
2011 0x00,0x00, /* Align to DWORD (header is 42 bytes) */
2012 0x00,0x00,0x00,0x00, /* Context Help ID */
2013 0x00,0x00,0x00,0x00, /* Extended style */
2014 0x00,0x00,0x00,0x50, /* Style (WS_CHILD|WS_VISIBLE) */
2015 0x00,0x00, /* X */
2016 0x00,0x00, /* Y */
2017 0x80,0x00, /* Width */
2018 0x80,0x00, /* Height */
2019 0x00,0x01,0x00,0x00, /* Control ID (256) */
2020 0xff,0xff,0x82,0x00, /* Class (Static) */
2021 'W',0x00,'I',0x00, /* Caption (unicode) */
2022 'N',0x00,'E',0x00,
2023 ' ',0x00,'d',0x00,
2024 'i',0x00,'a',0x00,
2025 'l',0x00,'o',0x00,
2026 'g',0x00,' ',0x00,
2027 't',0x00,'e',0x00,
2028 's',0x00,'t',0x00,
2029 '.',0x00,0x00,0x00,
2030 0x00,0x00, /* Size of extended data */
2031
2032 0x00,0x00 /* Align to DWORD */
2033 };
2034
2035 HWND hDlg;
2036 HFONT hFont;
2037 LOGFONTW lfStaticFont;
2038 NONCLIENTMETRICSW ncMetrics;
2039
2040 /* Check if the dialog can be created from the template. On Win9x, this should fail
2041 * because we are calling the W function which is not implemented, but that's what
2042 * we want, because passing such a template to CreateDialogIndirectParamA would crash
2043 * anyway.
2044 */
2046 if (!hDlg)
2047 {
2048 win_skip("dialog wasn't created\n");
2049 return;
2050 }
2051
2052 hFont = (HFONT) SendDlgItemMessageW(hDlg, 256, WM_GETFONT, 0, 0);
2053 if (!hFont)
2054 {
2055 skip("dialog uses system font\n");
2056 DestroyWindow(hDlg);
2057 return;
2058 }
2059 GetObjectW(hFont, sizeof(LOGFONTW), &lfStaticFont);
2060
2061 ncMetrics.cbSize = FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth);
2062 SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncMetrics, 0);
2063 /* The height doesn't match on Windows 10 1709+. */
2064 ncMetrics.lfMessageFont.lfHeight = lfStaticFont.lfHeight;
2065 ok( !memcmp(&lfStaticFont, &ncMetrics.lfMessageFont, FIELD_OFFSET(LOGFONTW, lfFaceName)) &&
2066 !lstrcmpW(lfStaticFont.lfFaceName, ncMetrics.lfMessageFont.lfFaceName),
2067 "dialog doesn't use message box font\n");
2068 DestroyWindow(hDlg);
2069}
#define skip(...)
Definition: atltest.h:64
HFONT hFont
Definition: main.c:53
#define win_skip
Definition: minitest.h:67
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static INT_PTR CALLBACK messageBoxFontDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1971
LONG lfHeight
Definition: dimm.idl:59
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define WM_GETFONT
Definition: winuser.h:1679
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
HWND WINAPI CreateDialogIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by START_TEST().

◆ test_SaveRestoreFocus()

static void test_SaveRestoreFocus ( void  )
static

Definition at line 2071 of file dialog.c.

2072{
2073 HWND hDlg;
2074 HRSRC hResource;
2075 HANDLE hTemplate;
2076 DLGTEMPLATE* pTemplate;
2077 LONG_PTR foundId;
2078 HWND foundHwnd;
2079
2080 /* create the dialog */
2081 hResource = FindResourceA(g_hinst, "MULTI_EDIT_DIALOG", (LPCSTR)RT_DIALOG);
2082 hTemplate = LoadResource(g_hinst, hResource);
2083 pTemplate = LockResource(hTemplate);
2084
2086 ok (hDlg != 0, "Failed to create test dialog.\n");
2087
2088 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2089 ok (foundId == 1000, "First edit box should have gained focus on dialog creation. Expected: %d, Found: %Id\n", 1000, foundId);
2090
2093 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2094 ok (foundId == 1001, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %Id\n", 1001, foundId);
2096
2097 /* de- then reactivate the dialog */
2100
2101 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2102 ok (foundId == 1000, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %Id\n", 1000, foundId);
2103
2104 /* select the next tabbable item */
2106
2107 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2108 ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %Id\n", 1001, foundId);
2109
2110 /* de- then reactivate the dialog */
2113
2114 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2115 ok (foundId == 1001, "Second edit box should have gained focus after dialog reactivation. Expected: %d, Found: %Id\n", 1001, foundId);
2116
2117 /* set focus to the dialog */
2118 SetFocus(hDlg);
2119
2120 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2121 ok (foundId == 1000, "First edit box should have gained focus on dialog focus. Expected: %d, Found: %Id\n", 1000, foundId);
2122
2123 /* select second tabbable item */
2125
2126 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2127 ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %Id\n", 1001, foundId);
2128
2129 /* send WM_ACTIVATE message to already active dialog */
2131
2132 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2133 ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %Id\n", 1001, foundId);
2134
2135 /* disable the 2nd box */
2137
2138 foundHwnd = GetFocus();
2139 ok (foundHwnd == NULL, "Second edit box should have lost focus after being disabled. Expected: %p, Found: %p\n", NULL, foundHwnd);
2140
2141 /* de- then reactivate the dialog */
2144
2145 foundHwnd = GetFocus();
2146 ok (foundHwnd == NULL, "No controls should have gained focus after dialog reactivation. Expected: %p, Found: %p\n", NULL, foundHwnd);
2147
2148 /* clean up */
2149 DestroyWindow(hDlg);
2150}
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117
#define WA_INACTIVE
Definition: winuser.h:2664

Referenced by START_TEST().

◆ test_static_create_procA()

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

Definition at line 2398 of file dialog.c.

2399{
2400 if (msg == WM_NCCREATE)
2401 {
2403 memcpy( cs_name_paramA, cs->lpszName, sizeof(cs_name_paramA) );
2404 }
2405
2407}
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define WM_NCCREATE
Definition: winuser.h:1711

Referenced by test_create_controls().

◆ test_static_create_procW()

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

Definition at line 2387 of file dialog.c.

2388{
2389 if (msg == WM_NCCREATE)
2390 {
2392 memcpy( cs_name_paramW, cs->lpszName, sizeof(cs_name_paramW) );
2393 }
2394
2396}

Referenced by test_create_controls().

◆ test_timer_message()

static void test_timer_message ( void  )
static

Definition at line 2196 of file dialog.c.

2197{
2198 DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc);
2199}
static INT_PTR CALLBACK timer_message_dlg_proc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:2152

Referenced by START_TEST().

◆ test_WM_NEXTDLGCTL()

static void test_WM_NEXTDLGCTL ( void  )
static

Definition at line 647 of file dialog.c.

648{
649 HWND child1, child2, child3;
650 MSG msg;
651 DWORD dwVal;
652
655 "WM_NEXTDLGCTLWndClass",
656 "WM_NEXTDLGCTL Message test window",
659 0, 0, 235, 135,
660 NULL, NULL, g_hinst, 0);
661
666
667 /*
668 * Test message DM_SETDEFID
669 */
670
673 dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
674
675 ok ( IDCANCEL == (LOWORD(dwVal)), "Did not set default ID\n" );
676
677 /*
678 * Check whether message WM_NEXTDLGCTL is changing the focus to next control and if
679 * the destination control is a button, style of the button should be changed to
680 * BS_DEFPUSHBUTTON with out making it default.
681 */
682
683 /* Keep the focus on Edit control. */
685 ok((GetFocus() == g_hwndTestDlgEdit), "Focus didn't set on Edit control\n");
686
687 /* Test message WM_NEXTDLGCTL */
689 ok((GetFocus() == g_hwndTestDlgBut1), "Focus didn't move to first button\n");
690
691 /* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL" */
692 dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
693 ok(IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
694
695 /*
696 * Check whether the style of the button which got the focus, changed to BS_DEFPUSHBUTTON and
697 * the style of default button changed to BS_PUSHBUTTON.
698 */
699 ok(get_button_style(g_hwndTestDlgBut1) == BS_DEFPUSHBUTTON, "Button1's style not set to BS_DEFPUSHBUTTON\n");
700 ok(get_button_style(g_hwndTestDlgBut2) == BS_PUSHBUTTON, "Button2's style not set to BS_PUSHBUTTON\n");
701
702 /* Move focus to Button2 using "WM_NEXTDLGCTL" */
704 ok((GetFocus() == g_hwndTestDlgBut2), "Focus didn't move to second button\n");
705
706 /* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL" */
707 dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
708 ok(IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
709
710 /*
711 * Check whether the style of the button which got the focus, changed to BS_DEFPUSHBUTTON and
712 * the style of button which lost the focus changed to BS_PUSHBUTTON.
713 */
714 ok(get_button_style(g_hwndTestDlgBut1) == BS_PUSHBUTTON, "Button1's style not set to BS_PUSHBUTTON\n");
715 ok(get_button_style(g_hwndTestDlgBut2) == BS_DEFPUSHBUTTON, "Button2's style not set to BS_DEFPUSHBUTTON\n");
716
717 /* Move focus to Edit control using "WM_NEXTDLGCTL" */
719 ok((GetFocus() == g_hwndTestDlgEdit), "Focus didn't move to Edit control\n");
720
721 /* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL" */
722 dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
723 ok(IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
724
725 /* test nested default buttons */
726
727 child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 50, 50,
729 ok(child1 != NULL, "failed to create first child\n");
730 child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 60, 60, 30, 30,
732 ok(child2 != NULL, "failed to create second child\n");
733 /* create nested child */
734 child3 = CreateWindowA("button", "child3", WS_VISIBLE|WS_CHILD, 10, 10, 10, 10,
735 child1, (HMENU)300, g_hinst, NULL);
736 ok(child3 != NULL, "failed to create subchild\n");
737
739 dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
740 ok(LOWORD(dwVal) == 200, "expected 200, got %lx\n", dwVal);
741
743 dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
744 ok(LOWORD(dwVal) == 300, "expected 300, got %lx\n", dwVal);
746 "expected child3 not to be marked as DLGC_DEFPUSHBUTTON\n");
747
749 FormEnterMsg (&msg, child3);
750 ok(IsDialogMessageA(g_hwndTestDlg, &msg), "Did not handle the ENTER\n");
751 ok(g_bReceivedCommand, "Did not trigger the default Button action\n");
752
753 DestroyWindow(child3);
754 DestroyWindow(child2);
755 DestroyWindow(child1);
757}
static HWND g_hwndTestDlg
Definition: dialog.c:50
static DWORD get_button_style(HWND button)
Definition: dialog.c:150
static BOOL g_bReceivedCommand
Definition: dialog.c:54
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define WS_OVERLAPPED
Definition: pedump.c:615
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_POPUPWINDOW
Definition: pedump.c:638
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define DS_MODALFRAME
Definition: winuser.h:375
#define DLGC_DEFPUSHBUTTON
Definition: winuser.h:2657
#define WM_NEXTDLGCTL
Definition: winuser.h:1671
#define DS_SETFONT
Definition: winuser.h:378
#define BM_SETSTYLE
Definition: winuser.h:1953

Referenced by START_TEST().

◆ TestControlStyleDlgProc()

static INT_PTR CALLBACK TestControlStyleDlgProc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 1422 of file dialog.c.

1424{
1425 HWND control;
1426 DWORD style, exstyle;
1427 char buf[256];
1428
1429 switch (msg)
1430 {
1431 case WM_INITDIALOG:
1432 control = GetDlgItem(hdlg, 7);
1433 ok(control != 0, "dialog control with id 7 not found\n");
1435 ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#lx\n", style);
1437 ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE, got %#lx\n", exstyle);
1438 buf[0] = 0;
1439 GetWindowTextA(control, buf, sizeof(buf));
1440 ok(strcmp(buf, "bump7") == 0, "expected bump7, got %s\n", buf);
1441
1442 control = GetDlgItem(hdlg, 8);
1443 ok(control != 0, "dialog control with id 8 not found\n");
1445 ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#lx\n", style);
1447 ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT, got %#lx\n", exstyle);
1448 buf[0] = 0;
1449 GetWindowTextA(control, buf, sizeof(buf));
1450 ok(strcmp(buf, "bump8") == 0, "expected bump8, got %s\n", buf);
1451
1452 EndDialog(hdlg, -7);
1453 return TRUE;
1454 }
1455 return FALSE;
1456}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WS_EX_TRANSPARENT
Definition: pedump.c:649

Referenced by test_DialogBoxParam().

◆ TestDefButtonDlgProc()

static INT_PTR CALLBACK TestDefButtonDlgProc ( HWND  hDlg,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1370 of file dialog.c.

1372{
1373 switch (uiMsg)
1374 {
1375 case WM_INITDIALOG:
1376 EndDialog(hDlg, LOWORD(SendMessageA(hDlg, DM_GETDEFID, 0, 0)));
1377 return TRUE;
1378 }
1379 return FALSE;
1380}

Referenced by test_DialogBoxParam().

◆ testDlgWinProc()

static LRESULT CALLBACK testDlgWinProc ( HWND  hwnd,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 530 of file dialog.c.

532{
533 switch (uiMsg)
534 {
535 /* Add blank case statements for these to ensure we don't use them
536 * by mistake.
537 */
538 case DM_GETDEFID: break;
539 case DM_SETDEFID: break;
540
541 case WM_CREATE:
542 return (OnTestDlgCreate (hwnd,
543 (LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1);
544 case WM_COMMAND:
545 if(LOWORD(wParam) == 300) g_bReceivedCommand = TRUE;
546 }
547
548 return DefDlgProcA (hwnd, uiMsg, wParam, lParam);
549}
static BOOL OnTestDlgCreate(HWND hwnd, LPCREATESTRUCTA lpcs)
Definition: dialog.c:436

Referenced by RegisterWindowClasses().

◆ TestInitDialogHandleProc()

static INT_PTR CALLBACK TestInitDialogHandleProc ( HWND  hDlg,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1354 of file dialog.c.

1356{
1357 if (uiMsg == WM_INITDIALOG)
1358 {
1360 ok(expected == (HWND)wParam,
1361 "Expected wParam to be the handle to the first tabstop control (%p), got %p\n",
1362 expected, (HWND)wParam);
1363
1364 EndDialog(hDlg, LOWORD(SendMessageA(hDlg, DM_GETDEFID, 0, 0)));
1365 return TRUE;
1366 }
1367 return FALSE;
1368}
BOOL expected
Definition: store.c:2000

Referenced by test_DialogBoxParam().

◆ TestReturnKeyDlgProc()

static INT_PTR CALLBACK TestReturnKeyDlgProc ( HWND  hDlg,
UINT  uiMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1382 of file dialog.c.

1384{
1385 static int received_idok;
1386
1387 switch (uiMsg)
1388 {
1389 case WM_INITDIALOG:
1390 {
1391 MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001};
1392
1393 received_idok = -1;
1394 IsDialogMessageA(hDlg, &msg);
1395 ok(received_idok == 0xdead, "WM_COMMAND/0xdead not received\n");
1396
1397 received_idok = -2;
1398 IsDialogMessageA(hDlg, &msg);
1399 ok(received_idok == IDOK, "WM_COMMAND/IDOK not received\n");
1400
1401 EndDialog(hDlg, 0);
1402 return TRUE;
1403 }
1404
1405 case DM_GETDEFID:
1406 if (received_idok == -1)
1407 {
1408 HWND hwnd = GetDlgItem(hDlg, 0xdead);
1409 ok(!hwnd, "dialog item with ID 0xdead should not exist\n");
1411 return TRUE;
1412 }
1413 return FALSE;
1414
1415 case WM_COMMAND:
1416 received_idok = wParam;
1417 return TRUE;
1418 }
1419 return FALSE;
1420}
#define MAKELRESULT(l, h)
Definition: winuser.h:4118
#define DWLP_MSGRESULT
Definition: winuser.h:881

Referenced by test_DialogBoxParam().

◆ timer_message_dlg_proc()

static INT_PTR CALLBACK timer_message_dlg_proc ( HWND  wnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 2152 of file dialog.c.

2153{
2154 static int count;
2155 BOOL visible;
2156
2157 switch (msg)
2158 {
2159 case WM_INITDIALOG:
2160 visible = GetWindowLongA(wnd, GWL_STYLE) & WS_VISIBLE;
2161 ok(!visible, "Dialog should not be visible.\n");
2162 SetTimer(wnd, 1, 100, NULL);
2163 Sleep(200);
2164 return FALSE;
2165
2166 case WM_COMMAND:
2167 if (LOWORD(wparam) != IDCANCEL) return FALSE;
2168 EndDialog(wnd, LOWORD(wparam));
2169 return TRUE;
2170
2171 case WM_TIMER:
2172 if (wparam != 1) return FALSE;
2173 visible = GetWindowLongA(wnd, GWL_STYLE) & WS_VISIBLE;
2174 if (!count++)
2175 {
2176 ok(!visible, "Dialog should not be visible.\n");
2177 PostMessageA(wnd, WM_USER, 0, 0);
2178 }
2179 else
2180 {
2181 ok(visible, "Dialog should be visible.\n");
2183 }
2184 return TRUE;
2185
2186 case WM_USER:
2187 visible = GetWindowLongA(wnd, GWL_STYLE) & WS_VISIBLE;
2188 ok(visible, "Dialog should be visible.\n");
2189 return TRUE;
2190
2191 default:
2192 return FALSE;
2193 }
2194}
GLuint GLuint GLsizei count
Definition: gl.h:1545
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:726
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_TIMER
Definition: winuser.h:1770

Referenced by test_timer_message().

Variable Documentation

◆ cs_name_paramA

char cs_name_paramA[4]
static

Definition at line 2385 of file dialog.c.

Referenced by test_create_controls(), and test_static_create_procA().

◆ cs_name_paramW

WCHAR cs_name_paramW[3]
static

Definition at line 2384 of file dialog.c.

Referenced by test_create_controls(), and test_static_create_procW().

◆ g_bInitialFocusInitDlgResult

BOOL g_bInitialFocusInitDlgResult
static

Definition at line 54 of file dialog.c.

Referenced by delayFocusDlgWinProc(), and test_focus().

◆ g_bReceivedCommand

BOOL g_bReceivedCommand
static

Definition at line 54 of file dialog.c.

Referenced by test_WM_NEXTDLGCTL(), and testDlgWinProc().

◆ g_button1Clicked

BOOL g_button1Clicked
static

Definition at line 57 of file dialog.c.

Referenced by main_window_procA(), and test_IsDialogMessage().

◆ g_hinst

◆ g_hwndButton1

HWND g_hwndButton1
static

◆ g_hwndButton2

HWND g_hwndButton2
static

◆ g_hwndButtonCancel

HWND g_hwndButtonCancel
static

◆ g_hwndInitialFocusGroupBox

HWND g_hwndInitialFocusGroupBox
static

Definition at line 51 of file dialog.c.

Referenced by delayFocusDlgWinProc(), and GetHwndString().

◆ g_hwndInitialFocusT1

HWND g_hwndInitialFocusT1
static

Definition at line 51 of file dialog.c.

Referenced by delayFocusDlgWinProc(), focusDlgWinProc(), and test_focus().

◆ g_hwndInitialFocusT2

HWND g_hwndInitialFocusT2
static

Definition at line 51 of file dialog.c.

Referenced by delayFocusDlgWinProc(), and test_focus().

◆ g_hwndMain

HWND g_hwndMain
static

Definition at line 49 of file dialog.c.

Referenced by delayFocusDlgWinProc(), GetHwndString(), and test_IsDialogMessage().

◆ g_hwndTestDlg

HWND g_hwndTestDlg
static

Definition at line 50 of file dialog.c.

Referenced by test_WM_NEXTDLGCTL().

◆ g_hwndTestDlgBut1

HWND g_hwndTestDlgBut1
static

Definition at line 50 of file dialog.c.

Referenced by OnTestDlgCreate(), and test_WM_NEXTDLGCTL().

◆ g_hwndTestDlgBut2

HWND g_hwndTestDlgBut2
static

Definition at line 50 of file dialog.c.

Referenced by OnTestDlgCreate(), and test_WM_NEXTDLGCTL().

◆ g_hwndTestDlgEdit

HWND g_hwndTestDlgEdit
static

Definition at line 50 of file dialog.c.

Referenced by OnTestDlgCreate(), and test_WM_NEXTDLGCTL().

◆ g_MSGF_DIALOGBOX

BOOL g_MSGF_DIALOGBOX
static

Definition at line 765 of file dialog.c.

Referenced by hook_proc2(), and test_IsDialogMessage().

◆ g_styleInitialFocusT1

LONG g_styleInitialFocusT1
static

Definition at line 53 of file dialog.c.

Referenced by delayFocusDlgWinProc(), and test_focus().

◆ g_styleInitialFocusT2

LONG g_styleInitialFocusT2
static

Definition at line 53 of file dialog.c.

Referenced by delayFocusDlgWinProc(), and test_focus().

◆ g_terminated

BOOL g_terminated
static

◆ hierarchy

◆ hwnd

HWND hwnd[MAXHWNDS]
static

Definition at line 44 of file dialog.c.

◆ msgbox_hook_proc_called

unsigned int msgbox_hook_proc_called
static

Definition at line 2201 of file dialog.c.

Referenced by msgbox_hook_proc(), and test_MessageBox().

◆ msgbox_type

UINT msgbox_type
static

Definition at line 2202 of file dialog.c.

Referenced by msgbox_hook_proc(), and test_MessageBox().

◆ numwnds

unsigned int numwnds =1
static

Definition at line 45 of file dialog.c.

Referenced by CreateWindows(), and id().

◆ orig_static_proc

WNDPROC orig_static_proc
static

◆ testmodes

const char* testmodes[]
static
Initial value:
=
{
"SNDMSGA",
"SNDMSGW",
"DLGPROCA",
"DLGPROCW",
"SETTEXTA",
"SETTEXTW",
}

Definition at line 1471 of file dialog.c.

Referenced by test_aw_conversion_dlgprocA(), test_aw_conversion_dlgprocW(), and test_aw_conversion_wndproc().

◆ testtext

◆ testtextW

◆ wm_char_count

int wm_char_count
static

Definition at line 571 of file dialog.c.

Referenced by test_IsDialogMessage(), and test_IsDialogMessageA_proc().