ReactOS 0.4.16-dev-197-g92996da
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
 
struct  create_window_params
 

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 LRESULT 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 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)
 
DWORD WINAPI WorkerThread (void *param)
 
static void test_MessageBox_WM_COPY_Test (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 DWORD WINAPI create_window_thread (void *param)
 
static HWND wait_for_window (const char *caption)
 
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)
 
 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 BOOL g_MSGF_DIALOGBOX
 
static const WCHAR testtextW [] = {'W','n','d','T','e','x','t',0}
 
static const chartesttext = "WndText"
 
static const chartestmodes []
 
static const char msgbox_title [] = "%5!z9ZXw*ia;57n/FGl.bCH,Su\"mfKN;foCqAU\'j6AmoJgAc_D:Z0A\'E6PF_O/w"
 
static WCHAR expectedOK []
 
static WCHAR expectedOkCancel []
 
static WCHAR expectedAbortRetryIgnore []
 
static WCHAR expectedYesNo []
 
static WCHAR expectedYesNoCancel []
 
static WCHAR expectedRetryCancel []
 
static WCHAR expectedCancelTryContinue []
 
BOOL non_english = FALSE
 

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 1387 of file dialog.c.

1388{
1395};
@ DLGPROCTEXT_SNDMSGA
Definition: dialog.c:1389
@ DLGPROCTEXT_SETTEXTW
Definition: dialog.c:1394
@ DLGPROCTEXT_DLGPROCW
Definition: dialog.c:1392
@ DLGPROCTEXT_DLGPROCA
Definition: dialog.c:1391
@ DLGPROCTEXT_SNDMSGW
Definition: dialog.c:1390
@ DLGPROCTEXT_SETTEXTA
Definition: dialog.c:1393

Function Documentation

◆ create_window_thread()

static DWORD WINAPI create_window_thread ( void param)
static

Definition at line 2338 of file dialog.c.

2339{
2340 struct create_window_params *p = param;
2341 HWND owner = 0;
2342
2343 if (p->owner)
2344 {
2345 owner = CreateWindowExA(0, "Static", NULL, WS_POPUP, 10, 10, 10, 10, 0, 0, 0, NULL);
2346 ok(owner != 0, "failed to create owner window\n");
2347 }
2348
2349 MessageBoxA(owner, NULL, p->caption, p->style);
2350
2352
2353 return 0;
2354}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
GLfloat GLfloat p
Definition: glext.h:8902
GLfloat param
Definition: glext.h:5796
#define WS_POPUP
Definition: pedump.c:616
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)
int WINAPI MessageBoxA(_In_opt_ HWND hWnd, _In_opt_ LPCSTR lpText, _In_opt_ LPCSTR lpCaption, _In_ UINT uType)
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by test_MessageBox().

◆ 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 %ld 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 %ld is out of range\n", p->id);
180 return FALSE;
181 }
182 if (hwnd[p->id] != 0)
183 {
184 trace ("Control %ld is used more than once\n", p->id);
185 return FALSE;
186 }
187
188 /* Create the control */
189 sprintf (ctrlname, "ctrl%4.4ld", 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 %ld\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 %ld: %8.8x %8.8x cf %8.8x %8.8x\n", p->id, style, exstyle, p->style, p->exstyle);
208 }
209 }
210 p++;
211 }
212
213 return TRUE;
214}
Arabic default style
Definition: afstyles.h:94
#define trace
Definition: atltest.h:70
#define ARRAY_SIZE(A)
Definition: main.h:20
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned long DWORD
Definition: ntddk_ex.h:95
#define sprintf(buf, format,...)
Definition: sprintf.c:55
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:63
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
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define GWL_STYLE
Definition: winuser.h:855
#define GWL_EXSTYLE
Definition: winuser.h:854

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 2450 of file dialog.c.

2451{
2452 if (msg == WM_INITDIALOG)
2453 EndDialog(hdlg, 0);
2454
2455 return FALSE;
2456}
#define msg(x)
Definition: auth_time.c:54
#define WM_INITDIALOG
Definition: winuser.h:1742
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by test_dialog_custom_data().

◆ delayFocusDlgWinProc()

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

Definition at line 824 of file dialog.c.

826{
827 switch (uiMsg)
828 {
829 case WM_INITDIALOG:
830 g_hwndMain = hDlg;
832 g_hwndButton1 = GetDlgItem(hDlg,200);
833 g_hwndButton2 = GetDlgItem(hDlg,201);
836
837 /* Initially check the second radio button */
840 /* Continue testing after dialog initialization */
841 PostMessageA(hDlg, WM_USER, 0, 0);
843
844 case WM_COMMAND:
845 if (LOWORD(wParam) == IDCANCEL)
846 {
847 EndDialog(hDlg, LOWORD(wParam));
848 return TRUE;
849 }
850 return FALSE;
851
852 case WM_USER:
855 SetFocus(hDlg);
858 return TRUE;
859 }
860
861 return FALSE;
862}
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:1865
#define IDCANCEL
Definition: winuser.h:834
#define BST_UNCHECKED
Definition: winuser.h:199
#define WM_COMMAND
Definition: winuser.h:1743
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:1924
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_USER
Definition: winuser.h:1898
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#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 1251 of file dialog.c.

1253{
1254 if (uiMsg == WM_INITDIALOG)
1255 {
1256 DestroyWindow(hDlg);
1257 return TRUE;
1258 }
1259 return FALSE;
1260}

Referenced by test_DialogBoxParam().

◆ DestroyOnCloseDlgWinProc()

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

Definition at line 1262 of file dialog.c.

1264{
1265 switch (uiMsg)
1266 {
1267 case WM_INITDIALOG:
1268 PostMessageA(hDlg, WM_CLOSE, 0, 0);
1269 return TRUE;
1270 case WM_CLOSE:
1271 DestroyWindow(hDlg);
1272 return TRUE;
1273 case WM_DESTROY:
1274 PostQuitMessage(0);
1275 return TRUE;
1276 }
1277 return FALSE;
1278}
#define WM_CLOSE
Definition: winuser.h:1624
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_DESTROY
Definition: winuser.h:1612

Referenced by test_DialogBoxParam().

◆ disabled_test_proc()

static LRESULT 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(x)
Definition: debug.h:53
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:2612
#define IDOK
Definition: winuser.h:833
#define VK_RETURN
Definition: winuser.h:2204
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define WM_KEYDOWN
Definition: winuser.h:1718
#define DM_GETDEFID
Definition: winuser.h:2101

Referenced by test_DisabledDialogTest().

◆ dlg_test_aw_message()

static void dlg_test_aw_message ( HWND  hdlg,
UINT  msg 
)
static

Definition at line 1505 of file dialog.c.

1506{
1507 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SNDMSGA));
1508 SendMessageA(hdlg, msg, 0, (LPARAM)testtext);
1509
1510 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SNDMSGW));
1511 SendMessageW(hdlg, msg, 0, (LPARAM)testtextW);
1512
1513 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_DLGPROCA));
1514 DefDlgProcA(hdlg, msg, 0, (LPARAM)testtext);
1515
1516 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_DLGPROCW));
1517 DefDlgProcW(hdlg, msg, 0, (LPARAM)testtextW);
1518}
#define ULongToHandle(h)
Definition: basetsd.h:81
static const char * testtext
Definition: dialog.c:1385
static const WCHAR testtextW[]
Definition: dialog.c:1384
LONG_PTR LPARAM
Definition: windef.h:208
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 885 of file dialog.c.

886{
887 switch(uMsg) {
888 case WM_INITDIALOG:
889 return TRUE;
890 }
891 return FALSE;
892}

Referenced by focusChildDlgWinProc().

◆ focusChildDlgWinProc()

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

Definition at line 894 of file dialog.c.

896{
897 static HWND hChildDlg;
898
899 switch (uiMsg)
900 {
901 case WM_INITDIALOG:
902 {
903 RECT rectHwnd;
904 struct {
905 DLGTEMPLATE tmplate;
906 WORD menu,class,title;
907 } temp;
908
909 SetFocus( GetDlgItem(hwnd, 200) );
910
911 GetClientRect(hwnd,&rectHwnd);
913 temp.tmplate.dwExtendedStyle = 0;
914 temp.tmplate.cdit = 0;
915 temp.tmplate.x = 0;
916 temp.tmplate.y = 0;
917 temp.tmplate.cx = 0;
918 temp.tmplate.cy = 0;
919 temp.menu = temp.class = temp.title = 0;
920
921 hChildDlg = CreateDialogIndirectParamA(g_hinst, &temp.tmplate,
923 ok(hChildDlg != 0, "Failed to create test dialog.\n");
924
925 return FALSE;
926 }
927 case WM_CLOSE:
928 DestroyWindow(hChildDlg);
929 return TRUE;
930 }
931
932 return FALSE;
933}
#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:885
static HINSTANCE g_hinst
Definition: dialog.c:48
#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 864 of file dialog.c.

866{
867 switch (uiMsg)
868 {
869 case WM_INITDIALOG:
870 SetWindowTextA(GetDlgItem(hDlg, 200), "new caption");
871 return TRUE;
872
873 case WM_COMMAND:
874 if (LOWORD(wParam) == 200)
875 {
876 if (HIWORD(wParam) == EN_SETFOCUS)
878 }
879 return FALSE;
880 }
881
882 return FALSE;
883}
HANDLE HWND
Definition: compat.h:19
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define EN_SETFOCUS
Definition: winuser.h:2030

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:2202

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 1159 of file dialog.c.

1160{
1161 if (msg == WM_INITDIALOG)
1162 {
1163 char text[64];
1164 LONG_PTR val;
1165 HWND hwnd;
1166 BOOL ret;
1167
1168 hwnd = GetDlgItem(hdlg, -1);
1169 ok(hwnd != NULL, "Expected dialog item.\n");
1170
1171 *text = 0;
1172 ret = GetDlgItemTextA(hdlg, -1, text, ARRAY_SIZE(text));
1173 ok(ret && !strcmp(text, "Text1"), "Unexpected item text.\n");
1174
1176 ok(val == -1, "Unexpected id.\n");
1177
1179 ok(val == -1, "Unexpected id %ld.\n", val);
1180
1181 hwnd = GetDlgItem(hdlg, -2);
1182 ok(hwnd != NULL, "Expected dialog item.\n");
1183
1185 ok(val == -2, "Unexpected id.\n");
1186
1188 ok(val == -2, "Unexpected id %ld.\n", val);
1189
1190 EndDialog(hdlg, 0xdead);
1191 }
1192
1193 return FALSE;
1194}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
const WCHAR * text
Definition: package.c:1794
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLfloat * val
Definition: glext.h:7180
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
int ret
UINT WINAPI GetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPSTR lpString, int nMaxCount)
Definition: dialog.c:2245
#define GetWindowLongPtrA
Definition: winuser.h:4831
#define GWLP_ID
Definition: winuser.h:863

Referenced by test_GetDlgItem().

◆ GetHwndString()

static const char * GetHwndString ( HWND  hw)
static

Definition at line 936 of file dialog.c.

937{
938 if (hw == NULL)
939 return "a null handle";
940 if (hw == g_hwndMain)
941 return "the dialog handle";
943 return "the group box control";
944 if (hw == g_hwndButton1)
945 return "the first button";
946 if (hw == g_hwndButton2)
947 return "the second button";
948 if (hw == g_hwndButtonCancel)
949 return "the cancel button";
950
951 return "unknown handle";
952}

Referenced by test_focus().

◆ hook_proc()

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

Definition at line 716 of file dialog.c.

717{
718 ok(0, "unexpected hook called, code %d\n", code);
720}
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 723 of file dialog.c.

724{
725 ok(code == MSGF_DIALOGBOX, "unexpected hook called, code %d\n", code);
728}
static BOOL g_MSGF_DIALOGBOX
Definition: dialog.c:722
#define MSGF_DIALOGBOX
Definition: winuser.h:1176

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

◆ 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}
static int repeat
Definition: xmllint.c:137

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}
static BOOL OnMainWindowCreate(HWND hwnd, LPCREATESTRUCTA lpcs)
Definition: dialog.c:411
static BOOL g_button1Clicked
Definition: dialog.c:57
LONG_PTR LRESULT
Definition: windef.h:209
#define DM_SETDEFID
Definition: winuser.h:2102
#define WM_CREATE
Definition: winuser.h:1611

Referenced by RegisterWindowClasses().

◆ messageBoxFontDlgWinProc()

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

Definition at line 1894 of file dialog.c.

1896{
1897 if (uiMsg == WM_INITDIALOG) {
1898 SetFocus(hDlg);
1899 return 1;
1900 }
1901
1902 return 0;
1903}

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 2303 of file dialog.c.

2304{
2305 if (code == HCBT_ACTIVATE)
2306 {
2307 HWND msgbox = (HWND)wParam, msghwnd;
2308 char text[64];
2309
2310 if (msgbox)
2311 {
2312 text[0] = 0;
2313 GetWindowTextA(msgbox, text, sizeof(text));
2314 ok(!strcmp(text, "MSGBOX caption"), "Unexpected window text \"%s\"\n", text);
2315
2316 msghwnd = GetDlgItem(msgbox, 0xffff);
2317 ok(msghwnd != NULL, "Expected static control\n");
2318
2319 text[0] = 0;
2320 GetWindowTextA(msghwnd, text, sizeof(text));
2321 ok(!strcmp(text, "Text"), "Unexpected window text \"%s\"\n", text);
2322
2325 }
2326 }
2327
2329}
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1302
#define HCBT_ACTIVATE
Definition: winuser.h:60
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
#define WM_LBUTTONUP
Definition: winuser.h:1780
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:4318
#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 571 of file dialog.c.

572{
573 WNDCLASSA cls;
574
575 cls.style = 0;
577 cls.cbClsExtra = 0;
578 cls.cbWndExtra = 0;
579 cls.hInstance = g_hinst;
580 cls.hIcon = NULL;
582 cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
583 cls.lpszMenuName = NULL;
584 cls.lpszClassName = "GetNextDlgItemWindowClass";
585
586 if (!RegisterClassA (&cls)) return FALSE;
587
589 cls.lpszClassName = "IsDialogMessageWindowClass";
590 if (!RegisterClassA (&cls)) return FALSE;
591
593 cls.lpszClassName = "TESTCONTROL";
594 if (!RegisterClassA (&cls)) return FALSE;
595
596 GetClassInfoA(0, "#32770", &cls);
598 cls.lpszClassName = "WM_NEXTDLGCTLWndClass";
599 if (!RegisterClassA (&cls)) return FALSE;
600
601 return TRUE;
602}
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
HBRUSH hbrBackground
Definition: winuser.h:3173
HICON hIcon
Definition: winuser.h:3171
HINSTANCE hInstance
Definition: winuser.h:3170
HCURSOR hCursor
Definition: winuser.h:3172
int cbWndExtra
Definition: winuser.h:3169
UINT style
Definition: winuser.h:3166
LPCSTR lpszMenuName
Definition: winuser.h:3174
LPCSTR lpszClassName
Definition: winuser.h:3175
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbClsExtra
Definition: winuser.h:3168
#define COLOR_WINDOW
Definition: winuser.h:921
#define IDC_ARROW
Definition: winuser.h:687
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:2142
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dialog  )

Definition at line 2463 of file dialog.c.

2464{
2466
2467 if (!RegisterWindowClasses()) assert(0);
2468
2473 test_focus();
2483}
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
static void test_MessageBox(void)
Definition: dialog.c:2379
static void test_WM_NEXTDLGCTL(void)
Definition: dialog.c:604
static void test_IsDialogMessage(void)
Definition: dialog.c:730
static void test_dialog_custom_data(void)
Definition: dialog.c:2458
static void test_focus(void)
Definition: dialog.c:954
static void test_GetDlgItemText(void)
Definition: dialog.c:1146
static void test_GetNextDlgItem(void)
Definition: dialog.c:348
static void test_SaveRestoreFocus(void)
Definition: dialog.c:2173
static void test_GetDlgItem(void)
Definition: dialog.c:1196
static void test_MessageBox_WM_COPY_Test(void)
Definition: dialog.c:2144
static void test_DialogBoxParam(void)
Definition: dialog.c:1816
static void test_MessageBoxFontTest(void)
Definition: dialog.c:1905
static void test_timer_message(void)
Definition: dialog.c:2298
static BOOL RegisterWindowClasses(void)
Definition: dialog.c:571
static void test_DisabledDialogTest(void)
Definition: dialog.c:1887

◆ test_aw_conversion_dlgproc()

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

Definition at line 1520 of file dialog.c.

1521{
1522 ULONG_PTR dlgproc, originalproc;
1523 WCHAR buffW[64];
1524 char buff[64];
1525 BOOL ret;
1526 INT len;
1527
1528 switch (msg)
1529 {
1530 case WM_INITDIALOG:
1531 ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1532
1540
1541 /* WM_SETTEXT/WM_GETTEXT */
1542 originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1543 ok(originalproc == (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", originalproc);
1544
1545 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1546 ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", dlgproc);
1547
1549 ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1550
1551 dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1552 ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1553
1554 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1555 ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1556
1557 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1558 ret = SetWindowTextA(hdlg, testtext);
1559 todo_wine
1560 ok(ret, "Failed to set window text.\n");
1561
1562 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1563 ret = SetWindowTextW(hdlg, testtextW);
1564 todo_wine
1565 ok(ret, "Failed to set window text.\n");
1566
1567 memset(buff, 'A', sizeof(buff));
1568 len = GetWindowTextA(hdlg, buff, sizeof(buff));
1569 ok(buff[0] == 0 && buff[1] == 'A' && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1570 (BYTE)buff[0], (BYTE)buff[1], len);
1571
1572 memset(buffW, 0xff, sizeof(buffW));
1573 len = GetWindowTextW(hdlg, buffW, 64);
1574 ok(!lstrcmpW(buffW, testtextW) && len == 0, "Unexpected window text %s, len %d\n", wine_dbgstr_w(buffW), len);
1575
1583
1585 ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1586
1587 dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1588 ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1589
1590 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1591 ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1592
1593 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1594 ret = SetWindowTextA(hdlg, testtext);
1595 todo_wine
1596 ok(ret, "Failed to set window text.\n");
1597
1598 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1599 ret = SetWindowTextW(hdlg, testtextW);
1600 todo_wine
1601 ok(ret, "Failed to set window text.\n");
1602
1603 memset(buff, 'A', sizeof(buff));
1604 len = GetWindowTextA(hdlg, buff, sizeof(buff));
1605 ok(buff[0] == 0 && buff[1] == 'A' && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1606 (BYTE)buff[0], (BYTE)buff[1], len);
1607
1608 memset(buffW, 0xff, sizeof(buffW));
1609 len = GetWindowTextW(hdlg, buffW, ARRAY_SIZE(buffW));
1610 ok(buffW[0] == 'W' && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1611 buffW[0], buffW[1], len);
1612
1620
1621 SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
1622 EndDialog(hdlg, -123);
1623 return TRUE;
1624 }
1625 return FALSE;
1626}
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4243
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: custom.c:89
static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1457
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1505
static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1520
static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1407
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define memset(x, y, z)
Definition: compat.h:39
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:1384
#define LB_ADDFILE
Definition: winuser.h:2033
#define SetWindowLongPtrA
Definition: winuser.h:5357
#define GetWindowLongPtrW
Definition: winuser.h:4832
#define DWLP_DLGPROC
Definition: winuser.h:874
#define LB_DIR
Definition: winuser.h:2036
#define WM_WININICHANGE
Definition: winuser.h:1633
#define EM_REPLACESEL
Definition: winuser.h:2009
#define WM_DEVMODECHANGE
Definition: winuser.h:1634
#define CB_DIR
Definition: winuser.h:1941
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define WM_SETTEXT
Definition: winuser.h:1620
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define SetWindowLongPtrW
Definition: winuser.h:5358
__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 1628 of file dialog.c.

1629{
1630 ULONG_PTR dlgproc, originalproc;
1631 WCHAR buffW[64];
1632 char buff[64];
1633 BOOL ret;
1634 INT len;
1635
1636 switch (msg)
1637 {
1638 case WM_INITDIALOG:
1639 ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1640
1648
1649 originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1650 ok(originalproc != (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#lx.\n", originalproc);
1651
1652 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1653 ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#lx.\n", dlgproc);
1654
1656 ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1657
1658 dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1659 ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1660
1661 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1662 ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1663
1664 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1665 ret = SetWindowTextA(hdlg, testtext);
1666 todo_wine
1667 ok(ret, "Failed to set window text.\n");
1668
1669 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1670 ret = SetWindowTextW(hdlg, testtextW);
1671 todo_wine
1672 ok(ret, "Failed to set window text.\n");
1673
1674 memset(buff, 'A', sizeof(buff));
1675 len = GetWindowTextA(hdlg, buff, sizeof(buff));
1676 ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
1677
1678 memset(buffW, 0xff, sizeof(buffW));
1679 len = GetWindowTextW(hdlg, buffW, 64);
1680 ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %s, len %d\n",
1681 wine_dbgstr_w(buffW), len);
1682
1690
1692 ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1693
1694 dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1695 ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1696
1697 dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1698 ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1699
1700 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1701 ret = SetWindowTextA(hdlg, testtext);
1702 todo_wine
1703 ok(ret, "Failed to set window text.\n");
1704
1705 SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1706 ret = SetWindowTextW(hdlg, testtextW);
1707 todo_wine
1708 ok(ret, "Failed to set window text.\n");
1709
1710 memset(buff, 'A', sizeof(buff));
1711 len = GetWindowTextA(hdlg, buff, sizeof(buff));
1712 ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
1713
1714 memset(buffW, 0xff, sizeof(buffW));
1715 len = GetWindowTextW(hdlg, buffW, ARRAY_SIZE(buffW));
1716 ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1717 buffW[0], buffW[1], len);
1718
1726
1727 SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
1728 EndDialog(hdlg, -123);
1729 return TRUE;
1730 }
1731 return FALSE;
1732}
static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1628

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 1776 of file dialog.c.

1777{
1778 BOOL is_unicode = !!lparam;
1779 LONG_PTR oldproc;
1780
1781 switch (msg)
1782 {
1783 case WM_INITDIALOG:
1784 ok(is_unicode == IsWindowUnicode(hdlg), "Unexpected unicode window property.\n");
1785
1787 SetWindowLongPtrA(hdlg, GWLP_USERDATA, oldproc);
1788 ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1789
1797
1799 ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1800
1808
1809 SetWindowLongPtrA(hdlg, GWLP_WNDPROC, oldproc);
1810 EndDialog(hdlg, -123);
1811 return TRUE;
1812 }
1813 return FALSE;
1814}
@ lparam
Definition: SystemMenu.c:31
static LRESULT CALLBACK test_aw_conversion_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1734
#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 1407 of file dialog.c.

1408{
1409 int mode = HandleToULong(GetPropA(hdlg, "test_mode"));
1410 WCHAR *text = (WCHAR *)lparam;
1411 char *textA = (char *)lparam;
1412
1413 switch (msg)
1414 {
1415 case WM_SETTEXT:
1416 case WM_WININICHANGE:
1417 case WM_DEVMODECHANGE:
1418 case CB_DIR:
1419 case LB_DIR:
1420 case LB_ADDFILE:
1421 case EM_REPLACESEL:
1422 switch (mode)
1423 {
1425 ok(textA == testtext, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A",
1426 testmodes[mode], textA);
1427 break;
1429 ok(text == testtextW, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A", testmodes[mode],
1431 break;
1434 if (IsWindowUnicode(hdlg))
1435 {
1437 "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1438 }
1439 else
1440 ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1441 break;
1444 if (IsWindowUnicode(hdlg))
1445 ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1446 else
1447 ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1448 testmodes[mode], textA);
1449 break;
1450 }
1451 break;
1452 };
1453
1454 return DefWindowProcW(hdlg, msg, wparam, lparam);
1455}
@ wparam
Definition: SystemMenu.c:30
#define HandleToULong(h)
Definition: basetsd.h:95
GLenum mode
Definition: glext.h:6217
static const char textA[]
Definition: registrar.c:40
static const char * testmodes[]
Definition: dialog.c:1397
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 1457 of file dialog.c.

1458{
1459 int mode = HandleToULong(GetPropA(hdlg, "test_mode"));
1460 WCHAR *text = (WCHAR *)lparam;
1461 char *textA = (char *)lparam;
1462
1463 switch (msg)
1464 {
1465 case WM_SETTEXT:
1466 case WM_WININICHANGE:
1467 case WM_DEVMODECHANGE:
1468 case CB_DIR:
1469 case LB_DIR:
1470 case LB_ADDFILE:
1471 case EM_REPLACESEL:
1472 switch (mode)
1473 {
1475 ok(textA == testtext, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A",
1476 testmodes[mode], textA);
1477 break;
1479 ok(text == testtextW, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A", testmodes[mode],
1481 break;
1484 if (IsWindowUnicode(hdlg))
1486 "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1487 else
1488 ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1489 break;
1492 if (IsWindowUnicode(hdlg))
1493 ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1494 else
1495 ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1496 testmodes[mode], textA);
1497 break;
1498 }
1499 break;
1500 }
1501
1502 return DefWindowProcA(hdlg, msg, wparam, lparam);
1503}

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 1734 of file dialog.c.

1735{
1737 int mode = HandleToULong(GetPropA(hwnd, "test_mode"));
1738 WCHAR *text = (WCHAR *)lparam;
1739 char *textA = (char *)lparam;
1740
1741 switch (msg)
1742 {
1743 case WM_SETTEXT:
1744 case WM_WININICHANGE:
1745 case WM_DEVMODECHANGE:
1746 case CB_DIR:
1747 case LB_DIR:
1748 case LB_ADDFILE:
1749 case EM_REPLACESEL:
1750 switch (mode)
1751 {
1753 if (IsWindowUnicode(hwnd))
1755 "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1756 else
1757 ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1758 break;
1760 if (IsWindowUnicode(hwnd))
1761 ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1762 else
1763 ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1764 testmodes[mode], textA);
1765 break;
1766 default:
1767 ok(0, "Unexpected test mode %d.\n", mode);
1768 }
1769 break;
1770 }
1771
1772 return IsWindowUnicode(hwnd) ? CallWindowProcW(oldproc, hwnd, msg, wparam, lparam) :
1773 CallWindowProcA(oldproc, hwnd, msg, wparam, lparam);
1774}
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
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_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}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
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_dialog_custom_data()

static void test_dialog_custom_data ( void  )
static

Definition at line 2458 of file dialog.c.

2459{
2460 DialogBoxA(g_hinst, "CUSTOM_TEST_DIALOG", NULL, custom_test_dialog_proc);
2461}
static INT_PTR CALLBACK custom_test_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:2450
#define DialogBoxA(i, t, p, f)
Definition: winuser.h:4401

Referenced by START_TEST().

◆ test_DialogBoxParam()

static void test_DialogBoxParam ( void  )
static

Definition at line 1816 of file dialog.c.

1817{
1818 static const WCHAR nameW[] = {'T','E','S','T','_','E','M','P','T','Y','_','D','I','A','L','O','G',0};
1819 INT_PTR ret;
1820 HWND hwnd_invalid = (HWND)0x4444;
1821
1822 ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DLG_CHILD_POPUP", 0, TestControlStyleDlgProc, 0);
1823 ok(ret == -7, "expected -7, got %ld\n", ret);
1824
1825 SetLastError(0xdeadbeef);
1826 ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_DIALOG" , hwnd_invalid, 0 , 0);
1827 ok(0 == ret || broken(ret == -1), "DialogBoxParamA returned %ld, expected 0\n", ret);
1829 broken(GetLastError() == 0xdeadbeef),
1830 "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
1831
1832 /* Test a dialog which destroys itself on WM_INITDIALOG. */
1833 SetLastError(0xdeadbeef);
1835 ok(-1 == ret, "DialogBoxParamA returned %ld, expected -1\n", ret);
1838 broken(GetLastError() == 0xdeadbeef),
1839 "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
1840
1841 /* Test a dialog which destroys itself on WM_CLOSE. */
1843 ok(0 == ret, "DialogBoxParamA returned %ld, expected 0\n", ret);
1844
1845 SetLastError(0xdeadbeef);
1846 ret = DialogBoxParamA(GetModuleHandleA(NULL), "RESOURCE_INVALID" , 0, 0, 0);
1847 ok(-1 == ret, "DialogBoxParamA returned %ld, expected -1\n", ret);
1849 broken(GetLastError() == 0xdeadbeef),
1850 "got %d, expected ERROR_RESOURCE_NAME_NOT_FOUND\n",GetLastError());
1851
1852 SetLastError(0xdeadbeef);
1853 ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DIALOG_INVALID_CLASS", 0, DestroyDlgWinProc, 0);
1854 ok(ret == -1, "DialogBoxParamA returned %ld, expected -1\n", ret);
1855 ok(GetLastError() == 0, "got %d\n", GetLastError());
1856
1857 SetLastError(0xdeadbeef);
1858 ret = DefDlgProcA(0, WM_ERASEBKGND, 0, 0);
1859 ok(ret == 0, "DefDlgProcA returned %ld, expected 0\n", ret);
1861 broken(GetLastError() == 0xdeadbeef),
1862 "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n", GetLastError());
1863
1864 ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestInitDialogHandleProc, 0);
1865 ok(ret == IDOK, "Expected IDOK\n");
1866
1867 ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestDefButtonDlgProc, 0);
1868 ok(ret == IDOK, "Expected IDOK\n");
1869
1870 ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestReturnKeyDlgProc, 0);
1871 ok(ret == 0, "Unexpected ret value %ld.\n", ret);
1872
1873 /* WM_SETTEXT handling in case of A/W dialog procedures vs A/W dialog window. */
1875 ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1876
1878 ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1879
1881 ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1882
1884 ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1885}
#define broken(x)
Definition: atltest.h:178
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:1296
static INT_PTR CALLBACK TestControlStyleDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1348
static INT_PTR CALLBACK DestroyDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1251
static INT_PTR CALLBACK TestInitDialogHandleProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1280
static INT_PTR CALLBACK test_aw_conversion_dlgproc3(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1776
static INT_PTR CALLBACK DestroyOnCloseDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1262
static INT_PTR CALLBACK TestReturnKeyDlgProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1308
int32_t INT_PTR
Definition: typedefs.h:64
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
#define ERROR_RESOURCE_NAME_NOT_FOUND
Definition: winerror.h:1121
#define WM_ERASEBKGND
Definition: winuser.h:1628
INT_PTR WINAPI DialogBoxParamA(_In_opt_ HINSTANCE, _In_ LPCSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

Referenced by START_TEST().

◆ test_DisabledDialogTest()

static void test_DisabledDialogTest ( void  )
static

Definition at line 1887 of file dialog.c.

1888{
1890 DialogBoxParamA(g_hinst, "IDD_DIALOG", NULL, disabled_test_proc, 0);
1891 ok(FALSE == g_terminated, "dialog with disabled ok button has been terminated\n");
1892}
static LRESULT 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 954 of file dialog.c.

955{
956 /* Test 1:
957 * This test intentionally returns FALSE in response to WM_INITDIALOG
958 * without setting focus to a control. This is what MFC's CFormView does.
959 *
960 * Since the WM_INITDIALOG handler returns FALSE without setting the focus,
961 * the focus should initially be NULL. Later, when we manually set focus to
962 * the dialog, the default handler should set focus to the first control that
963 * is "visible, not disabled, and has the WS_TABSTOP style" (MSDN). Because the
964 * second radio button has been checked, it should be the first control
965 * that meets these criteria and should receive the focus.
966 */
967
973
974 DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);
975
977 "Error in wrc - Detected WS_TABSTOP as default style for GROUPBOX\n");
978
980 "Modal dialogs should not be shown until the message queue first goes empty\n");
981
983 "Error in initial focus when WM_INITDIALOG returned FALSE: "
984 "Expected NULL focus, got %s (%p).\n",
986
988 "Error after first SetFocus() when WM_INITDIALOG returned FALSE: "
989 "Expected the second button (%p), got %s (%p).\n",
992
993 /* Test 2:
994 * This is the same as above, except WM_INITDIALOG is made to return TRUE.
995 * This should cause the focus to go to the second radio button right away
996 * and stay there (until the user indicates otherwise).
997 */
998
1004
1005 DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);
1006
1008 "Error in initial focus when WM_INITDIALOG returned TRUE: "
1009 "Expected the second button (%p), got %s (%p).\n",
1012
1014 "Error after first SetFocus() when WM_INITDIALOG returned TRUE: "
1015 "Expected the second button (%p), got %s (%p).\n",
1018
1019 /* Test 3:
1020 * If the dialog has DS_CONTROL and it's not visible then we shouldn't change focus */
1021 {
1022 HWND hDlg;
1023 HRSRC hResource;
1024 HANDLE hTemplate;
1025 DLGTEMPLATE* pTemplate;
1026 HWND hTextbox;
1027 DWORD selectionStart = 0xdead, selectionEnd = 0xbeef;
1028
1029 hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG", (LPCSTR)RT_DIALOG);
1030 hTemplate = LoadResource(g_hinst, hResource);
1031 pTemplate = LockResource(hTemplate);
1032
1035 ok (hDlg != 0, "Failed to create test dialog.\n");
1036
1037 ok ((g_hwndInitialFocusT1 == 0),
1038 "Focus should not be set for an invisible DS_CONTROL dialog %p.\n", g_hwndInitialFocusT1);
1039
1040 /* Also make sure that WM_SETFOCUS selects the textbox's text */
1041 hTextbox = GetDlgItem(hDlg, 200);
1042 SendMessageA(hTextbox, WM_SETTEXT, 0, (LPARAM)"Hello world");
1043
1044 SendMessageA(hDlg, WM_SETFOCUS, 0, 0);
1045 SendMessageA(hTextbox, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
1046 ok(selectionStart == 0 && selectionEnd == 11, "Text selection after WM_SETFOCUS is [%i, %i) expected [0, 11)\n", selectionStart, selectionEnd);
1047
1048 /* but WM_ACTIVATE does not */
1049 SendMessageA(hTextbox, EM_SETSEL, 0, 0);
1051 SendMessageA(hTextbox, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
1052 ok(selectionStart == 0 && selectionEnd == 0, "Text selection after WM_ACTIVATE is [%i, %i) expected [0, 0)\n", selectionStart, selectionEnd);
1053
1054 DestroyWindow(hDlg);
1055 }
1056
1057 /* Test 4:
1058 * If the dialog has no tab-accessible controls, set focus to first control */
1059 {
1060 HWND hDlg;
1061 HRSRC hResource;
1062 HANDLE hTemplate;
1063 DLGTEMPLATE* pTemplate;
1064 HWND hLabel;
1065
1066 hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_2", (LPCSTR)RT_DIALOG);
1067 hTemplate = LoadResource(g_hinst, hResource);
1068 pTemplate = LockResource(hTemplate);
1069
1071 ok(hDlg != 0, "Failed to create test dialog.\n");
1072 hLabel = GetDlgItem(hDlg, 200);
1073
1074 ok(GetFocus() == hLabel, "Focus not set to label, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1075
1076 DestroyWindow(hDlg);
1077
1078 /* Also check focus after WM_ACTIVATE and WM_SETFOCUS */
1079 hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, NULL, 0);
1080 ok(hDlg != 0, "Failed to create test dialog.\n");
1081 hLabel = GetDlgItem(hDlg, 200);
1082
1083 SetFocus(NULL);
1085 ok(GetFocus() == NULL, "Focus set on WM_ACTIVATE, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1086
1087 SetFocus(NULL);
1088 SendMessageA(hDlg, WM_SETFOCUS, 0, 0);
1089 ok(GetFocus() == hLabel, "Focus not set to label on WM_SETFOCUS, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1090
1091 DestroyWindow(hDlg);
1092 }
1093
1094 /* Test 5:
1095 * Select textbox's text on creation */
1096 {
1097 HWND hDlg;
1098 HRSRC hResource;
1099 HANDLE hTemplate;
1100 DLGTEMPLATE* pTemplate;
1101 HWND edit;
1102 DWORD selectionStart = 0xdead, selectionEnd = 0xbeef;
1103
1104 hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_3", (LPCSTR)RT_DIALOG);
1105 hTemplate = LoadResource(g_hinst, hResource);
1106 pTemplate = LockResource(hTemplate);
1107
1109 ok(hDlg != 0, "Failed to create test dialog.\n");
1110 edit = GetDlgItem(hDlg, 200);
1111
1112 ok(GetFocus() == edit, "Focus not set to edit, focus=%p, dialog=%p, edit=%p\n",
1113 GetFocus(), hDlg, edit);
1114 SendMessageA(edit, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
1115 ok(selectionStart == 0 && selectionEnd == 11,
1116 "Text selection after WM_SETFOCUS is [%i, %i) expected [0, 11)\n",
1117 selectionStart, selectionEnd);
1118
1119 DestroyWindow(hDlg);
1120 }
1121
1122 /* Test 6:
1123 * Select textbox's text on creation when WM_INITDIALOG creates a child dialog. */
1124 {
1125 HWND hDlg;
1126 HRSRC hResource;
1127 HANDLE hTemplate;
1128 DLGTEMPLATE* pTemplate;
1129 HWND edit;
1130
1131 hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_3", (LPCSTR)RT_DIALOG);
1132 hTemplate = LoadResource(g_hinst, hResource);
1133 pTemplate = LockResource(hTemplate);
1134
1136 ok(hDlg != 0, "Failed to create test dialog.\n");
1137 edit = GetDlgItem(hDlg, 200);
1138
1139 ok(GetFocus() == edit, "Focus not set to edit, focus=%p, dialog=%p, edit=%p\n",
1140 GetFocus(), hDlg, edit);
1141
1142 DestroyWindow(hDlg);
1143 }
1144}
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
static INT_PTR CALLBACK focusChildDlgWinProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:894
static INT_PTR CALLBACK delayFocusDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:824
static INT_PTR CALLBACK focusDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:864
static const char * GetHwndString(HWND hw)
Definition: dialog.c:936
#define RT_DIALOG
Definition: pedump.c:367
UINT_PTR WPARAM
Definition: windef.h:207
#define EM_GETSEL
Definition: winuser.h:2000
#define WM_SETFOCUS
Definition: winuser.h:1616
#define WM_ACTIVATE
Definition: winuser.h:1615
#define EM_SETSEL
Definition: winuser.h:2021
#define WA_ACTIVE
Definition: winuser.h:2626

Referenced by START_TEST().

◆ test_GetDlgItem()

static void test_GetDlgItem ( void  )
static

Definition at line 1196 of file dialog.c.

1197{
1198 HWND hwnd, child1, child2, hwnd2;
1199 INT_PTR retval;
1200 BOOL ret;
1201
1202 hwnd = CreateWindowA("button", "parent", WS_VISIBLE, 0, 0, 100, 100, NULL, 0, g_hinst, NULL);
1203 ok(hwnd != NULL, "failed to created window\n");
1204
1205 /* created with the same ID */
1206 child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
1207 ok(child1 != NULL, "failed to create first child\n");
1208 child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
1209 ok(child2 != NULL, "failed to create second child\n");
1210
1211 hwnd2 = GetDlgItem(hwnd, 0);
1212 ok(hwnd2 == child1, "expected first child, got %p\n", hwnd2);
1213
1214 hwnd2 = GetTopWindow(hwnd);
1215 ok(hwnd2 == child1, "expected first child to be top, got %p\n", hwnd2);
1216
1217 ret = SetWindowPos(child1, child2, 0, 0, 0, 0, SWP_NOMOVE);
1218 ok(ret, "got %d\n", ret);
1219 hwnd2 = GetTopWindow(hwnd);
1220 ok(hwnd2 == child2, "expected second child to be top, got %p\n", hwnd2);
1221
1222 /* top window from child list is picked */
1223 hwnd2 = GetDlgItem(hwnd, 0);
1224 ok(hwnd2 == child2, "expected second child, got %p\n", hwnd2);
1225
1226 /* Now test how GetDlgItem searches */
1227 DestroyWindow(child2);
1228 child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, child1, 0, g_hinst, NULL);
1229 ok(child2 != NULL, "failed to create second child\n");
1230
1231 /* give child2 an ID */
1232 SetWindowLongA(child2, GWLP_ID, 100);
1233
1234 hwnd2 = GetDlgItem(hwnd, 100);
1235 ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);
1236
1237 /* make the ID of child2 public with a WS_EX_CONTROLPARENT parent */
1239
1240 hwnd2 = GetDlgItem(hwnd, 100);
1241 ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);
1242
1243 DestroyWindow(child1);
1244 DestroyWindow(child2);
1246
1247 retval = DialogBoxParamA(g_hinst, "GETDLGITEM_TEST_DIALOG", NULL, getdlgitem_test_dialog_proc, 0);
1248 ok(retval == 0xdead, "Unexpected return value.\n");
1249}
static INT_PTR CALLBACK getdlgitem_test_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1159
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 WS_EX_CONTROLPARENT
Definition: winuser.h:387
#define SWP_NOMOVE
Definition: winuser.h:1247
HWND WINAPI GetTopWindow(_In_opt_ HWND)

Referenced by START_TEST().

◆ test_GetDlgItemText()

static void test_GetDlgItemText ( void  )
static

Definition at line 1146 of file dialog.c.

1147{
1148 char string[64];
1149 BOOL ret;
1150
1151 strcpy(string, "Overwrite Me");
1152 ret = GetDlgItemTextA(NULL, 0, string, ARRAY_SIZE(string));
1153 ok(!ret, "GetDlgItemText(NULL) shouldn't have succeeded\n");
1154
1155 ok(string[0] == '\0' || broken(!strcmp(string, "Overwrite Me")),
1156 "string retrieved using GetDlgItemText should have been NULL terminated\n");
1157}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

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}
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
#define todo_wine_if(is_todo)
Definition: custom.c:86
static ATOM item
Definition: dde.c:856
static BOOL CreateWindows(HINSTANCE hinst)
Definition: dialog.c:155
_In_opt_ PSID Group
Definition: rtlfuncs.h:1658
#define test
Definition: rosglue.h:37
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 730 of file dialog.c.

731{
732 HHOOK hook;
733 MSG msg;
734
735 g_hwndMain = CreateWindowA("IsDialogMessageWindowClass", "IsDialogMessageWindowClass",
738 NULL, NULL, g_hinst, 0);
739
743
744 if (0)
745 {
746 /* crashes on Windows */
749 }
750
751 /* The focus should initially be nowhere. The first TAB should take it
752 * to the first button. The second TAB should take it to the Cancel
753 * button.
754 */
755
756 /* valid window, invalid message window */
758 FormTabMsg (&msg, (HWND)0xbeefbeef);
759 ok (!IsDialogMessageA(g_hwndMain, &msg), "expected failure\n");
760 ok(g_MSGF_DIALOGBOX, "hook wasn't called\n");
763
766
767 ok (!IsDialogMessageA(NULL, &msg), "expected failure\n");
768 ok (!IsDialogMessageA((HWND)0xbeefbeef, &msg), "expected failure\n");
769
771
772 ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle first TAB\n");
773 ok ((GetFocus() == g_hwndButton1), "Focus did not move to first button\n");
775 ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle second TAB\n");
777 "Focus did not move to cancel button\n");
779 ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
780 ok (g_terminated, "ENTER did not terminate\n");
781
782 /* matching but invalid window handles, NULL */
784
785 FormTabMsg (&msg, NULL);
786 ok (!IsDialogMessageA(msg.hwnd, &msg), "expected failure\n");
787
788 /* matching but invalid window handles, not NULL */
789 FormTabMsg (&msg, (HWND)0xbeefbeef);
790 ok (!IsDialogMessageA(msg.hwnd, &msg), "expected failure\n");
791
794
795 g_hwndMain = CreateWindowA("IsDialogMessageWindowClass", "IsDialogMessageWindowClass", WS_OVERLAPPEDWINDOW,
800 ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
801 ok(g_button1Clicked, "Did not receive button 1 click notification\n");
802
805 ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
806 ok(g_button1Clicked, "Did not receive button 1 click notification\n");
807
810 ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
811 ok(g_button1Clicked, "Did not receive button 1 click notification\n");
812
813 /* Button with id larger than 0xFFFF should also work */
817 ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
818 ok(g_button1Clicked, "Did not receive button 1 click notification\n");
819
821}
@ hook
Definition: SystemMenu.c:35
static LRESULT CALLBACK hook_proc2(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:723
static LRESULT CALLBACK hook_proc(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:716
static void FormTabMsg(MSG *pMsg, HWND hwnd)
Definition: dialog.c:224
static void FormEnterMsg(MSG *pMsg, HWND hwnd)
Definition: dialog.c:235
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#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 CW_USEDEFAULT
Definition: winuser.h:225

Referenced by START_TEST().

◆ test_MessageBox()

static void test_MessageBox ( void  )
static

Definition at line 2379 of file dialog.c.

2380{
2381 static const struct
2382 {
2383 DWORD mb_style;
2384 DWORD ex_style;
2385 } test[] =
2386 {
2387 { MB_OK, 0 },
2388 { MB_OK | MB_TASKMODAL, 0 },
2390 };
2392 HANDLE thread;
2393 DWORD tid, i;
2394 HHOOK hook;
2395 int ret;
2396
2398
2399 ret = MessageBoxA(NULL, "Text", "MSGBOX caption", MB_OKCANCEL);
2400 ok(ret == IDCANCEL, "got %d\n", ret);
2401
2403
2404 sprintf(params.caption, "pid %08x, tid %08x, time %08x",
2406
2407 params.owner = FALSE;
2408
2409 for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
2410 {
2411 HWND hwnd;
2412 DWORD ex_style;
2413
2414 params.style = test[i].mb_style;
2415
2417
2418 hwnd = wait_for_window(params.caption);
2419 ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
2420 ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style);
2421
2423
2424 ok(WaitForSingleObject(thread, 5000) != WAIT_TIMEOUT, "thread failed to terminate\n");
2426 }
2427
2428 params.owner = TRUE;
2429
2430 for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
2431 {
2432 HWND hwnd;
2433 DWORD ex_style;
2434
2435 params.style = test[i].mb_style;
2436
2438
2439 hwnd = wait_for_window(params.caption);
2440 ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
2441 ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style);
2442
2444
2445 ok(WaitForSingleObject(thread, 5000) != WAIT_TIMEOUT, "thread failed to terminate\n");
2447 }
2448}
static HANDLE thread
Definition: service.c:33
#define WAIT_TIMEOUT
Definition: dderror.h:14
#define CloseHandle
Definition: compat.h:739
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
GLenum const GLfloat * params
Definition: glext.h:5645
static TfClientId tid
static DWORD WINAPI create_window_thread(void *param)
Definition: dialog.c:2338
static HWND wait_for_window(const char *caption)
Definition: dialog.c:2356
static LRESULT CALLBACK msgbox_hook_proc(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:2303
#define WS_EX_TOPMOST
Definition: pedump.c:647
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
#define GetCurrentTime
Definition: winbase.h:2132
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
#define MB_SYSTEMMODAL
Definition: winuser.h:818
#define MB_TASKMODAL
Definition: winuser.h:819
#define WH_CBT
Definition: winuser.h:35
#define MB_OKCANCEL
Definition: winuser.h:807
#define MB_OK
Definition: winuser.h:793

Referenced by START_TEST().

◆ test_MessageBox_WM_COPY_Test()

static void test_MessageBox_WM_COPY_Test ( void  )
static

Definition at line 2144 of file dialog.c.

2145{
2146 DWORD tid = 0;
2147
2149 trace("non_english %d\n", non_english);
2150
2152 MessageBoxA(NULL, "Message", msgbox_title, MB_OK);
2153
2156
2159
2161 MessageBoxA(NULL, "Message", msgbox_title, MB_YESNO);
2162
2165
2168
2171}
LANGID WINAPI GetUserDefaultLangID(void)
Definition: locale.c:1177
static WCHAR expectedRetryCancel[]
Definition: dialog.c:2054
static WCHAR expectedOkCancel[]
Definition: dialog.c:2005
static const char msgbox_title[]
Definition: dialog.c:1992
static WCHAR expectedOK[]
Definition: dialog.c:1993
static WCHAR expectedCancelTryContinue[]
Definition: dialog.c:2066
static WCHAR expectedYesNo[]
Definition: dialog.c:2030
DWORD WINAPI WorkerThread(void *param)
Definition: dialog.c:2081
BOOL non_english
Definition: dialog.c:2079
static WCHAR expectedAbortRetryIgnore[]
Definition: dialog.c:2017
static WCHAR expectedYesNoCancel[]
Definition: dialog.c:2042
#define LANG_ENGLISH
Definition: nls.h:52
#define PRIMARYLANGID(l)
Definition: nls.h:16
#define MB_CANCELTRYCONTINUE
Definition: vfdguiut.c:34
#define MB_RETRYCANCEL
Definition: winuser.h:808
#define MB_YESNO
Definition: winuser.h:820
#define MB_ABORTRETRYIGNORE
Definition: winuser.h:794
#define MB_YESNOCANCEL
Definition: winuser.h:821

Referenced by START_TEST().

◆ test_MessageBoxFontTest()

static void test_MessageBoxFontTest ( void  )
static

Definition at line 1905 of file dialog.c.

1906{
1907 /* This dialog template defines a dialog template which got 0x7fff as its
1908 * font size and omits the other font members. On WinNT, passing such a
1909 * dialog template to CreateDialogIndirectParamW will result in a dialog
1910 * being created which uses the message box font. We test that here.
1911 */
1912
1913 static unsigned char dlgTemplate[] =
1914 {
1915 /* Dialog header */
1916 0x01,0x00, /* Version */
1917 0xff,0xff, /* Extended template marker */
1918 0x00,0x00,0x00,0x00, /* Context Help ID */
1919 0x00,0x00,0x00,0x00, /* Extended style */
1920 0xc0,0x00,0xc8,0x80, /* Style (WS_SYSMENU|WS_CAPTION|WS_POPUP|DS_SETFONT|DS_MODALFRAME) */
1921 0x01,0x00, /* Control count */
1922 0x00,0x00, /* X */
1923 0x00,0x00, /* Y */
1924 0x80,0x00, /* Width */
1925 0x80,0x00, /* Height */
1926 0x00,0x00, /* Menu name */
1927 0x00,0x00, /* Class name */
1928 'T',0x00,'e',0x00, /* Caption (unicode) */
1929 's',0x00,'t',0x00,
1930 0x00,0x00,
1931 0xff,0x7f, /* Font height (0x7fff = message box font) */
1932
1933 /* Control #1 */
1934 0x00,0x00, /* Align to DWORD (header is 42 bytes) */
1935 0x00,0x00,0x00,0x00, /* Context Help ID */
1936 0x00,0x00,0x00,0x00, /* Extended style */
1937 0x00,0x00,0x00,0x50, /* Style (WS_CHILD|WS_VISIBLE) */
1938 0x00,0x00, /* X */
1939 0x00,0x00, /* Y */
1940 0x80,0x00, /* Width */
1941 0x80,0x00, /* Height */
1942 0x00,0x01,0x00,0x00, /* Control ID (256) */
1943 0xff,0xff,0x82,0x00, /* Class (Static) */
1944 'W',0x00,'I',0x00, /* Caption (unicode) */
1945 'N',0x00,'E',0x00,
1946 ' ',0x00,'d',0x00,
1947 'i',0x00,'a',0x00,
1948 'l',0x00,'o',0x00,
1949 'g',0x00,' ',0x00,
1950 't',0x00,'e',0x00,
1951 's',0x00,'t',0x00,
1952 '.',0x00,0x00,0x00,
1953 0x00,0x00, /* Size of extended data */
1954
1955 0x00,0x00 /* Align to DWORD */
1956 };
1957
1958 HWND hDlg;
1959 HFONT hFont;
1960 LOGFONTW lfStaticFont;
1961 NONCLIENTMETRICSW ncMetrics;
1962
1963 /* Check if the dialog can be created from the template. On Win9x, this should fail
1964 * because we are calling the W function which is not implemented, but that's what
1965 * we want, because passing such a template to CreateDialogIndirectParamA would crash
1966 * anyway.
1967 */
1969 if (!hDlg)
1970 {
1971 win_skip("dialog wasn't created\n");
1972 return;
1973 }
1974
1975 hFont = (HFONT) SendDlgItemMessageW(hDlg, 256, WM_GETFONT, 0, 0);
1976 if (!hFont)
1977 {
1978 skip("dialog uses system font\n");
1979 DestroyWindow(hDlg);
1980 return;
1981 }
1982 GetObjectW(hFont, sizeof(LOGFONTW), &lfStaticFont);
1983
1984 ncMetrics.cbSize = FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth);
1985 SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncMetrics, 0);
1986 ok( !memcmp(&lfStaticFont, &ncMetrics.lfMessageFont, FIELD_OFFSET(LOGFONTW, lfFaceName)) &&
1987 !lstrcmpW(lfStaticFont.lfFaceName, ncMetrics.lfMessageFont.lfFaceName),
1988 "dialog doesn't use message box font\n");
1989 DestroyWindow(hDlg);
1990}
#define skip(...)
Definition: atltest.h:64
HFONT hFont
Definition: main.c:53
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
static INT_PTR CALLBACK messageBoxFontDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1894
#define win_skip
Definition: test.h:163
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:1654
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 2173 of file dialog.c.

2174{
2175 HWND hDlg;
2176 HRSRC hResource;
2177 HANDLE hTemplate;
2178 DLGTEMPLATE* pTemplate;
2179 LONG_PTR foundId;
2180 HWND foundHwnd;
2181
2182 /* create the dialog */
2183 hResource = FindResourceA(g_hinst, "MULTI_EDIT_DIALOG", (LPCSTR)RT_DIALOG);
2184 hTemplate = LoadResource(g_hinst, hResource);
2185 pTemplate = LockResource(hTemplate);
2186
2188 ok (hDlg != 0, "Failed to create test dialog.\n");
2189
2190 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2191 ok (foundId == 1000, "First edit box should have gained focus on dialog creation. Expected: %d, Found: %ld\n", 1000, foundId);
2192
2195 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2196 ok (foundId == 1001, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);
2198
2199 /* de- then reactivate the dialog */
2202
2203 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2204 ok (foundId == 1000, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1000, foundId);
2205
2206 /* select the next tabbable item */
2208
2209 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2210 ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
2211
2212 /* de- then reactivate the dialog */
2215
2216 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2217 ok (foundId == 1001, "Second edit box should have gained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);
2218
2219 /* set focus to the dialog */
2220 SetFocus(hDlg);
2221
2222 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2223 ok (foundId == 1000, "First edit box should have gained focus on dialog focus. Expected: %d, Found: %ld\n", 1000, foundId);
2224
2225 /* select second tabbable item */
2227
2228 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2229 ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
2230
2231 /* send WM_ACTIVATE message to already active dialog */
2233
2234 foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2235 ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
2236
2237 /* disable the 2nd box */
2239
2240 foundHwnd = GetFocus();
2241 ok (foundHwnd == NULL, "Second edit box should have lost focus after being disabled. Expected: %p, Found: %p\n", NULL, foundHwnd);
2242
2243 /* de- then reactivate the dialog */
2246
2247 foundHwnd = GetFocus();
2248 ok (foundHwnd == NULL, "No controls should have gained focus after dialog reactivation. Expected: %p, Found: %p\n", NULL, foundHwnd);
2249
2250 /* clean up */
2251 DestroyWindow(hDlg);
2252}
#define MAKEWPARAM(l, h)
Definition: winuser.h:4012
#define WA_INACTIVE
Definition: winuser.h:2625

Referenced by START_TEST().

◆ test_timer_message()

static void test_timer_message ( void  )
static

Definition at line 2298 of file dialog.c.

2299{
2300 DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc);
2301}
static INT_PTR CALLBACK timer_message_dlg_proc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:2254

Referenced by START_TEST().

◆ test_WM_NEXTDLGCTL()

static void test_WM_NEXTDLGCTL ( void  )
static

Definition at line 604 of file dialog.c.

605{
606 HWND child1, child2, child3;
607 MSG msg;
608 DWORD dwVal;
609
612 "WM_NEXTDLGCTLWndClass",
613 "WM_NEXTDLGCTL Message test window",
616 0, 0, 235, 135,
617 NULL, NULL, g_hinst, 0);
618
623
624 /*
625 * Test message DM_SETDEFID
626 */
627
630 dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
631
632 ok ( IDCANCEL == (LOWORD(dwVal)), "Did not set default ID\n" );
633
634 /*
635 * Check whether message WM_NEXTDLGCTL is changing the focus to next control and if
636 * the destination control is a button, style of the button should be changed to
637 * BS_DEFPUSHBUTTON with out making it default.
638 */
639
640 /* Keep the focus on Edit control. */
642 ok((GetFocus() == g_hwndTestDlgEdit), "Focus didn't set on Edit control\n");
643
644 /* Test message WM_NEXTDLGCTL */
646 ok((GetFocus() == g_hwndTestDlgBut1), "Focus didn't move to first button\n");
647
648 /* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL" */
649 dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
650 ok(IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
651
652 /*
653 * Check whether the style of the button which got the focus, changed to BS_DEFPUSHBUTTON and
654 * the style of default button changed to BS_PUSHBUTTON.
655 */
656 ok(get_button_style(g_hwndTestDlgBut1) == BS_DEFPUSHBUTTON, "Button1's style not set to BS_DEFPUSHBUTTON");
657 ok(get_button_style(g_hwndTestDlgBut2) == BS_PUSHBUTTON, "Button2's style not set to BS_PUSHBUTTON");
658
659 /* Move focus to Button2 using "WM_NEXTDLGCTL" */
661 ok((GetFocus() == g_hwndTestDlgBut2), "Focus didn't move to second button\n");
662
663 /* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL" */
664 dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
665 ok(IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
666
667 /*
668 * Check whether the style of the button which got the focus, changed to BS_DEFPUSHBUTTON and
669 * the style of button which lost the focus changed to BS_PUSHBUTTON.
670 */
671 ok(get_button_style(g_hwndTestDlgBut1) == BS_PUSHBUTTON, "Button1's style not set to BS_PUSHBUTTON");
672 ok(get_button_style(g_hwndTestDlgBut2) == BS_DEFPUSHBUTTON, "Button2's style not set to BS_DEFPUSHBUTTON");
673
674 /* Move focus to Edit control using "WM_NEXTDLGCTL" */
676 ok((GetFocus() == g_hwndTestDlgEdit), "Focus didn't move to Edit control\n");
677
678 /* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL" */
679 dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
680 ok(IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
681
682 /* test nested default buttons */
683
684 child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 50, 50,
686 ok(child1 != NULL, "failed to create first child\n");
687 child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 60, 60, 30, 30,
689 ok(child2 != NULL, "failed to create second child\n");
690 /* create nested child */
691 child3 = CreateWindowA("button", "child3", WS_VISIBLE|WS_CHILD, 10, 10, 10, 10,
692 child1, (HMENU)300, g_hinst, NULL);
693 ok(child3 != NULL, "failed to create subchild\n");
694
696 dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
697 ok(LOWORD(dwVal) == 200, "expected 200, got %x\n", dwVal);
698
700 dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
701 ok(LOWORD(dwVal) == 300, "expected 300, got %x\n", dwVal);
703 "expected child3 not to be marked as DLGC_DEFPUSHBUTTON\n");
704
706 FormEnterMsg (&msg, child3);
707 ok(IsDialogMessageA(g_hwndTestDlg, &msg), "Did not handle the ENTER\n");
708 ok(g_bReceivedCommand, "Did not trigger the default Button action\n");
709
710 DestroyWindow(child3);
711 DestroyWindow(child2);
712 DestroyWindow(child1);
714}
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_EX_DLGMODALFRAME
Definition: pedump.c:645
#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:2618
#define WM_NEXTDLGCTL
Definition: winuser.h:1646
#define DS_SETFONT
Definition: winuser.h:378
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define BM_SETSTYLE
Definition: winuser.h:1927
#define WM_GETDLGCODE
Definition: winuser.h:1692

Referenced by START_TEST().

◆ TestControlStyleDlgProc()

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

Definition at line 1348 of file dialog.c.

1350{
1351 HWND control;
1352 DWORD style, exstyle;
1353 char buf[256];
1354
1355 switch (msg)
1356 {
1357 case WM_INITDIALOG:
1358 control = GetDlgItem(hdlg, 7);
1359 ok(control != 0, "dialog control with id 7 not found\n");
1361 ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#x\n", style);
1363 ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE, got %#x\n", exstyle);
1364 buf[0] = 0;
1365 GetWindowTextA(control, buf, sizeof(buf));
1366 ok(strcmp(buf, "bump7") == 0, "expected bump7, got %s\n", buf);
1367
1368 control = GetDlgItem(hdlg, 8);
1369 ok(control != 0, "dialog control with id 8 not found\n");
1371 ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#x\n", style);
1373 ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT, got %#x\n", exstyle);
1374 buf[0] = 0;
1375 GetWindowTextA(control, buf, sizeof(buf));
1376 ok(strcmp(buf, "bump8") == 0, "expected bump8, got %s\n", buf);
1377
1378 EndDialog(hdlg, -7);
1379 return TRUE;
1380 }
1381 return FALSE;
1382}
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
Definition: dialog.c:52

Referenced by test_DialogBoxParam().

◆ TestDefButtonDlgProc()

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

Definition at line 1296 of file dialog.c.

1298{
1299 switch (uiMsg)
1300 {
1301 case WM_INITDIALOG:
1302 EndDialog(hDlg, LOWORD(SendMessageA(hDlg, DM_GETDEFID, 0, 0)));
1303 return TRUE;
1304 }
1305 return FALSE;
1306}

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 1280 of file dialog.c.

1282{
1283 if (uiMsg == WM_INITDIALOG)
1284 {
1286 ok(expected == (HWND)wParam,
1287 "Expected wParam to be the handle to the first tabstop control (%p), got %p\n",
1288 expected, (HWND)wParam);
1289
1290 EndDialog(hDlg, LOWORD(SendMessageA(hDlg, DM_GETDEFID, 0, 0)));
1291 return TRUE;
1292 }
1293 return FALSE;
1294}
BOOL expected
Definition: store.c:2063

Referenced by test_DialogBoxParam().

◆ TestReturnKeyDlgProc()

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

Definition at line 1308 of file dialog.c.

1310{
1311 static int received_idok;
1312
1313 switch (uiMsg)
1314 {
1315 case WM_INITDIALOG:
1316 {
1317 MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001};
1318
1319 received_idok = -1;
1320 IsDialogMessageA(hDlg, &msg);
1321 ok(received_idok == 0xdead, "WM_COMMAND/0xdead not received\n");
1322
1323 received_idok = -2;
1324 IsDialogMessageA(hDlg, &msg);
1325 ok(received_idok == IDOK, "WM_COMMAND/IDOK not received\n");
1326
1327 EndDialog(hDlg, 0);
1328 return TRUE;
1329 }
1330
1331 case DM_GETDEFID:
1332 if (received_idok == -1)
1333 {
1334 HWND hwnd = GetDlgItem(hDlg, 0xdead);
1335 ok(!hwnd, "dialog item with ID 0xdead should not exist\n");
1337 return TRUE;
1338 }
1339 return FALSE;
1340
1341 case WM_COMMAND:
1342 received_idok = wParam;
1343 return TRUE;
1344 }
1345 return FALSE;
1346}
#define MAKELRESULT(l, h)
Definition: winuser.h:4013
#define DWLP_MSGRESULT
Definition: winuser.h:873

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 2254 of file dialog.c.

2255{
2256 static int count;
2257 BOOL visible;
2258
2259 switch (msg)
2260 {
2261 case WM_INITDIALOG:
2262 visible = GetWindowLongA(wnd, GWL_STYLE) & WS_VISIBLE;
2263 ok(!visible, "Dialog should not be visible.\n");
2264 SetTimer(wnd, 1, 100, NULL);
2265 Sleep(200);
2266 return FALSE;
2267
2268 case WM_COMMAND:
2269 if (LOWORD(wparam) != IDCANCEL) return FALSE;
2270 EndDialog(wnd, LOWORD(wparam));
2271 return TRUE;
2272
2273 case WM_TIMER:
2274 if (wparam != 1) return FALSE;
2275 visible = GetWindowLongA(wnd, GWL_STYLE) & WS_VISIBLE;
2276 if (!count++)
2277 {
2278 ok(!visible, "Dialog should not be visible.\n");
2279 PostMessageA(wnd, WM_USER, 0, 0);
2280 }
2281 else
2282 {
2283 ok(visible, "Dialog should be visible.\n");
2285 }
2286 return TRUE;
2287
2288 case WM_USER:
2289 visible = GetWindowLongA(wnd, GWL_STYLE) & WS_VISIBLE;
2290 ok(visible, "Dialog should be visible.\n");
2291 return TRUE;
2292
2293 default:
2294 return FALSE;
2295 }
2296}
GLuint GLuint GLsizei count
Definition: gl.h:1545
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_TIMER
Definition: winuser.h:1745

Referenced by test_timer_message().

◆ wait_for_window()

static HWND wait_for_window ( const char caption)
static

Definition at line 2356 of file dialog.c.

2357{
2358 HWND hwnd;
2359 DWORD timeout = 0;
2360
2361 for (;;)
2362 {
2363 hwnd = FindWindowA(NULL, caption);
2364 if (hwnd) break;
2365
2366 Sleep(50);
2367 timeout += 50;
2368 if (timeout > 3000)
2369 {
2370 ok(0, "failed to wait for a window %s\n", caption);
2371 break;
2372 }
2373 }
2374
2375 Sleep(50);
2376 return hwnd;
2377}
Definition: dhcpd.h:245
HWND WINAPI FindWindowA(_In_opt_ LPCSTR, _In_opt_ LPCSTR)

Referenced by test_MessageBox().

◆ WorkerThread()

DWORD WINAPI WorkerThread ( void param)

Definition at line 2081 of file dialog.c.

2082{
2083 WCHAR *expected = param;
2084 char windowTitle[sizeof(msgbox_title)];
2085 HWND hwndMbox;
2086 BOOL succeeded = FALSE;
2087
2088 Sleep(200);
2089
2090 hwndMbox = GetForegroundWindow();
2091
2092 /* Find the Window, if it doesn't have focus */
2093 if (!(IsWindow(hwndMbox) &&
2094 GetWindowTextA(hwndMbox, windowTitle, sizeof(msgbox_title)) &&
2095 lstrcmpA(msgbox_title, windowTitle) == 0))
2096 {
2097 hwndMbox = FindWindowA(NULL, msgbox_title);
2098
2099 if (!IsWindow(hwndMbox))
2100 goto cleanup;
2101 }
2102
2103 SendMessageA(hwndMbox, WM_COPY, 0, 0);
2104
2106 {
2108 WCHAR *text = GlobalLock(textHandle);
2109
2110 if (text != NULL)
2111 {
2112 if(non_english)
2113 ok(lstrlenW(text) > 0, "Empty string on clipboard\n");
2114 else
2115 {
2116 succeeded = lstrcmpW(expected, text) == 0;
2117 if(!succeeded)
2118 {
2119 ok(0, "%s\n", wine_dbgstr_w(text));
2120 ok(0, "%s\n", wine_dbgstr_w(expected));
2121 }
2122 }
2123
2124 GlobalUnlock(textHandle);
2125 }
2126 else
2127 ok(0, "No text on clipboard.\n");
2128
2130
2131 }
2132 else
2133 trace("Clipboard error\n");
2134
2135 PostMessageA(hwndMbox, WM_COMMAND, IDIGNORE, 0); /* For MB_ABORTRETRYIGNORE dialog. */
2136 PostMessageA(hwndMbox, WM_CLOSE, 0, 0);
2137
2138cleanup:
2139 ok(succeeded || non_english, "Failed to get string.\n");
2140
2141 return 0;
2142}
#define CF_UNICODETEXT
Definition: constants.h:408
#define lstrlenW
Definition: compat.h:750
static void cleanup(void)
Definition: main.c:1335
int WINAPI lstrcmpA(LPCSTR str1, LPCSTR str2)
Definition: locale.c:4195
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
BOOL WINAPI IsWindow(_In_opt_ HWND)
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
HANDLE WINAPI GetClipboardData(_In_ UINT)
#define IDIGNORE
Definition: winuser.h:837
#define WM_COPY
Definition: winuser.h:1865
BOOL WINAPI IsClipboardFormatAvailable(_In_ UINT)

Referenced by test_MessageBox_WM_COPY_Test().

Variable Documentation

◆ expectedAbortRetryIgnore

WCHAR expectedAbortRetryIgnore[]
static
Initial value:
=
{
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'%','5','!','z','9','Z','X','w','*','i','a',';','5','7','n','/','F','G','l','.','b','C','H',',','S','u','"','m','f',
'K','N',';','f','o','C','q','A','U','\'','j','6','A','m','o','J','g','A','c','_','D',':','Z','0','A','\'','E','6','P',
'F','_','O','/','w','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'M','e','s','s','a','g','e','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'A','b','o','r','t',' ',' ',' ','R','e','t','r','y',' ',' ',' ','I','g','n','o','r','e',' ',' ',' ','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n', 0
}

Definition at line 2017 of file dialog.c.

Referenced by test_MessageBox_WM_COPY_Test().

◆ expectedCancelTryContinue

WCHAR expectedCancelTryContinue[]
static
Initial value:
=
{
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'%','5','!','z','9','Z','X','w','*','i','a',';','5','7','n','/','F','G','l','.','b','C','H',',','S','u','"','m','f',
'K','N',';','f','o','C','q','A','U','\'','j','6','A','m','o','J','g','A','c','_','D',':','Z','0','A','\'','E','6','P',
'F','_','O','/','w','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'M','e','s','s','a','g','e','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'C','a','n','c','e','l',' ',' ',' ','T','r','y',' ','A','g','a','i','n',' ',' ',' ','C','o','n','t','i','n','u','e',' ',' ',' ','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n', 0
}

Definition at line 2066 of file dialog.c.

Referenced by test_MessageBox_WM_COPY_Test().

◆ expectedOK

WCHAR expectedOK[]
static
Initial value:
=
{
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'%','5','!','z','9','Z','X','w','*','i','a',';','5','7','n','/','F','G','l','.','b','C','H',',','S','u','"','m','f',
'K','N',';','f','o','C','q','A','U','\'','j','6','A','m','o','J','g','A','c','_','D',':','Z','0','A','\'','E','6','P',
'F','_','O','/','w','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'M','e','s','s','a','g','e','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'O','K',' ',' ',' ','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n', 0
}

Definition at line 1993 of file dialog.c.

Referenced by test_MessageBox_WM_COPY_Test().

◆ expectedOkCancel

WCHAR expectedOkCancel[]
static
Initial value:
=
{
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'%','5','!','z','9','Z','X','w','*','i','a',';','5','7','n','/','F','G','l','.','b','C','H',',','S','u','"','m','f',
'K','N',';','f','o','C','q','A','U','\'','j','6','A','m','o','J','g','A','c','_','D',':','Z','0','A','\'','E','6','P',
'F','_','O','/','w','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'M','e','s','s','a','g','e','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'O','K',' ',' ',' ','C','a','n','c','e','l',' ',' ',' ','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n', 0
}

Definition at line 2005 of file dialog.c.

Referenced by test_MessageBox_WM_COPY_Test().

◆ expectedRetryCancel

WCHAR expectedRetryCancel[]
static
Initial value:
=
{
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'%','5','!','z','9','Z','X','w','*','i','a',';','5','7','n','/','F','G','l','.','b','C','H',',','S','u','"','m','f',
'K','N',';','f','o','C','q','A','U','\'','j','6','A','m','o','J','g','A','c','_','D',':','Z','0','A','\'','E','6','P',
'F','_','O','/','w','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'M','e','s','s','a','g','e','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'R','e','t','r','y',' ',' ',' ','C','a','n','c','e','l',' ',' ',' ','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n', 0
}

Definition at line 2054 of file dialog.c.

Referenced by test_MessageBox_WM_COPY_Test().

◆ expectedYesNo

WCHAR expectedYesNo[]
static
Initial value:
=
{
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'%','5','!','z','9','Z','X','w','*','i','a',';','5','7','n','/','F','G','l','.','b','C','H',',','S','u','"','m','f',
'K','N',';','f','o','C','q','A','U','\'','j','6','A','m','o','J','g','A','c','_','D',':','Z','0','A','\'','E','6','P',
'F','_','O','/','w','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'M','e','s','s','a','g','e','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'Y','e','s',' ',' ',' ','N','o',' ',' ',' ','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n', 0
}

Definition at line 2030 of file dialog.c.

Referenced by test_MessageBox_WM_COPY_Test().

◆ expectedYesNoCancel

WCHAR expectedYesNoCancel[]
static
Initial value:
=
{
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'%','5','!','z','9','Z','X','w','*','i','a',';','5','7','n','/','F','G','l','.','b','C','H',',','S','u','"','m','f',
'K','N',';','f','o','C','q','A','U','\'','j','6','A','m','o','J','g','A','c','_','D',':','Z','0','A','\'','E','6','P',
'F','_','O','/','w','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'M','e','s','s','a','g','e','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n',
'Y','e','s',' ',' ',' ','N','o',' ',' ',' ','C','a','n','c','e','l',' ',' ',' ','\r','\n',
'-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\r','\n', 0
}

Definition at line 2042 of file dialog.c.

Referenced by test_MessageBox_WM_COPY_Test().

◆ 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 722 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_title

const char msgbox_title[] = "%5!z9ZXw*ia;57n/FGl.bCH,Su\"mfKN;foCqAU\'j6AmoJgAc_D:Z0A\'E6PF_O/w"
static

Definition at line 1992 of file dialog.c.

Referenced by test_MessageBox_WM_COPY_Test(), and WorkerThread().

◆ non_english

BOOL non_english = FALSE

Definition at line 2079 of file dialog.c.

Referenced by test_MessageBox_WM_COPY_Test(), and WorkerThread().

◆ numwnds

unsigned int numwnds =1
static

Definition at line 45 of file dialog.c.

Referenced by CreateWindows(), and id().

◆ testmodes

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

Definition at line 1397 of file dialog.c.

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

◆ testtext

◆ testtextW