ReactOS  0.4.14-dev-52-g6116262
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 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 WINVER   0x0600 /* For NONCLIENTMETRICS with padding */
 
#define MAXHWNDS   1024
 

Enumerations

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

Functions

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 const charGetHwndString (HWND hw)
 
static void test_focus (void)
 
static void test_GetDlgItemText (void)
 
static void test_GetDlgItem (void)
 
static INT_PTR CALLBACK DestroyDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK DestroyOnCloseDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK TestInitDialogHandleProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK TestDefButtonDlgProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK TestReturnKeyDlgProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static INT_PTR CALLBACK TestControlStyleDlgProc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK test_aw_conversion_dlgprocA (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK test_aw_conversion_dlgprocW (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void dlg_test_aw_message (HWND hdlg, UINT msg)
 
static INT_PTR CALLBACK test_aw_conversion_dlgproc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK test_aw_conversion_dlgproc2 (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static LRESULT CALLBACK test_aw_conversion_wndproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static INT_PTR CALLBACK test_aw_conversion_dlgproc3 (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_DialogBoxParam (void)
 
static void test_DisabledDialogTest (void)
 
static INT_PTR CALLBACK messageBoxFontDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
 
static void test_MessageBoxFontTest (void)
 
static void test_SaveRestoreFocus (void)
 
static INT_PTR CALLBACK timer_message_dlg_proc (HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
 
static void test_timer_message (void)
 
static LRESULT CALLBACK msgbox_hook_proc (INT code, WPARAM wParam, LPARAM lParam)
 
static 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 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 []
 

Macro Definition Documentation

◆ MAXHWNDS

#define MAXHWNDS   1024

Definition at line 46 of file dialog.c.

◆ WINVER

#define WINVER   0x0600 /* For NONCLIENTMETRICS with padding */

Definition at line 33 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 1267 of file dialog.c.

Function Documentation

◆ create_window_thread()

static DWORD WINAPI create_window_thread ( void param)
static

Definition at line 2037 of file dialog.c.

2038 {
2039  struct create_window_params *p = param;
2040  HWND owner = 0;
2041 
2042  if (p->owner)
2043  {
2044  owner = CreateWindowExA(0, "Static", NULL, WS_POPUP, 10, 10, 10, 10, 0, 0, 0, NULL);
2045  ok(owner != 0, "failed to create owner window\n");
2046  }
2047 
2048  MessageBoxA(owner, NULL, p->caption, p->style);
2049 
2050  if (owner) DestroyWindow(owner);
2051 
2052  return 0;
2053 }
BOOL WINAPI DestroyWindow(_In_ HWND)
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
smooth NULL
Definition: ftsmooth.c:416
GLfloat param
Definition: glext.h:5796
#define ok(value,...)
Definition: atltest.h:57
#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)
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by test_MessageBox().

◆ CreateWindows()

static BOOL CreateWindows ( HINSTANCE  hinst)
static

Definition at line 152 of file dialog.c.

153 {
154  const h_entry *p = hierarchy;
155 
156  while (p->id != 0)
157  {
158  DWORD style, exstyle;
159  char ctrlname[9];
160 
161  /* Basically assert that the hierarchy is valid and track the
162  * maximum control number
163  */
164  if (p->id >= numwnds)
165  {
166  if (p->id >= sizeof(hwnd)/sizeof(hwnd[0]))
167  {
168  trace ("Control %ld is out of range\n", p->id);
169  return FALSE;
170  }
171  else
172  numwnds = p->id+1;
173  }
174  if (p->id <= 0)
175  {
176  trace ("Control %ld is out of range\n", p->id);
177  return FALSE;
178  }
179  if (hwnd[p->id] != 0)
180  {
181  trace ("Control %ld is used more than once\n", p->id);
182  return FALSE;
183  }
184 
185  /* Create the control */
186  sprintf (ctrlname, "ctrl%4.4ld", p->id);
187  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);
188  if (!hwnd[p->id])
189  {
190  trace ("Failed to create control %ld\n", p->id);
191  return FALSE;
192  }
193 
194  /* Check that the styles are as we specified (except the main one
195  * which is quite frequently messed up). If this keeps breaking then
196  * we could mask out the bits that don't concern us.
197  */
198  if (p->parent)
199  {
201  exstyle = GetWindowLongA(hwnd[p->id], GWL_EXSTYLE);
202  if (style != p->style || exstyle != p->exstyle)
203  {
204  trace ("Style mismatch at %ld: %8.8x %8.8x cf %8.8x %8.8x\n", p->id, style, exstyle, p->style, p->exstyle);
205  }
206  }
207  p++;
208  }
209 
210  return TRUE;
211 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define GWL_EXSTYLE
Definition: winuser.h:845
static const h_entry hierarchy[]
Definition: dialog.c:68
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static unsigned int numwnds
Definition: dialog.c:48
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define trace
Definition: atltest.h:70
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: dialog.c:61
#define GWL_STYLE
Definition: winuser.h:846
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)
static HINSTANCE hinst
Definition: edit.c:551
GLfloat GLfloat p
Definition: glext.h:8902
Arabic default style
Definition: afstyles.h:93
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

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

2150 {
2151  if (msg == WM_INITDIALOG)
2152  EndDialog(hdlg, 0);
2153 
2154  return FALSE;
2155 }
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
#define msg(x)
Definition: auth_time.c:54
#define WM_INITDIALOG
Definition: winuser.h:1721

Referenced by test_dialog_custom_data().

◆ delayFocusDlgWinProc()

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

Definition at line 818 of file dialog.c.

820 {
821  switch (uiMsg)
822  {
823  case WM_INITDIALOG:
824  g_hwndMain = hDlg;
826  g_hwndButton1 = GetDlgItem(hDlg,200);
827  g_hwndButton2 = GetDlgItem(hDlg,201);
830 
831  /* Initially check the second radio button */
834  /* Continue testing after dialog initialization */
835  PostMessageA(hDlg, WM_USER, 0, 0);
837 
838  case WM_COMMAND:
839  if (LOWORD(wParam) == IDCANCEL)
840  {
841  EndDialog(hDlg, LOWORD(wParam));
842  return TRUE;
843  }
844  return FALSE;
845 
846  case WM_USER:
849  SetFocus(hDlg);
851  PostMessageA(hDlg, WM_COMMAND, IDCANCEL, 0);
852  return TRUE;
853  }
854 
855  return FALSE;
856 }
#define TRUE
Definition: types.h:120
static HWND g_hwndButtonCancel
Definition: dialog.c:52
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND g_hwndInitialFocusT2
Definition: dialog.c:54
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HWND WINAPI SetFocus(_In_opt_ HWND)
WPARAM wParam
Definition: combotst.c:138
static LONG g_styleInitialFocusT1
Definition: dialog.c:56
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define BM_SETCHECK
Definition: winuser.h:1903
static HWND g_hwndInitialFocusGroupBox
Definition: dialog.c:54
#define WM_COMMAND
Definition: winuser.h:1722
#define BST_UNCHECKED
Definition: winuser.h:199
#define WM_USER
Definition: winuser.h:1877
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
static HWND g_hwndMain
Definition: dialog.c:52
#define BST_CHECKED
Definition: winuser.h:197
HWND WINAPI GetFocus(void)
Definition: window.c:1905
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2126
#define IDCANCEL
Definition: winuser.h:825
static HWND g_hwndButton1
Definition: dialog.c:52
static BOOL g_bInitialFocusInitDlgResult
Definition: dialog.c:57
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
static HWND g_hwndButton2
Definition: dialog.c:52
static LONG g_styleInitialFocusT2
Definition: dialog.c:56
static HWND g_hwndInitialFocusT1
Definition: dialog.c:54

Referenced by test_focus().

◆ DestroyDlgWinProc()

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

Definition at line 1131 of file dialog.c.

1133 {
1134  if (uiMsg == WM_INITDIALOG)
1135  {
1136  DestroyWindow(hDlg);
1137  return TRUE;
1138  }
1139  return FALSE;
1140 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WM_INITDIALOG
Definition: winuser.h:1721

Referenced by test_DialogBoxParam().

◆ DestroyOnCloseDlgWinProc()

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

Definition at line 1142 of file dialog.c.

1144 {
1145  switch (uiMsg)
1146  {
1147  case WM_INITDIALOG:
1148  PostMessageA(hDlg, WM_CLOSE, 0, 0);
1149  return TRUE;
1150  case WM_CLOSE:
1151  DestroyWindow(hDlg);
1152  return TRUE;
1153  case WM_DESTROY:
1154  PostQuitMessage(0);
1155  return TRUE;
1156  }
1157  return FALSE;
1158 }
#define TRUE
Definition: types.h:120
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_INITDIALOG
Definition: winuser.h:1721
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

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

487 {
488  switch (uiMsg)
489  {
490  case WM_INITDIALOG:
491  {
492  DWORD dw;
493  HWND hwndOk;
494 
495  dw = SendMessageA(hwnd, DM_GETDEFID, 0, 0);
497  hwndOk = GetDlgItem(hwnd, LOWORD(dw));
498  assert(hwndOk);
499  EnableWindow(hwndOk, FALSE);
500 
503  break;
504  }
505  case WM_COMMAND:
506  if (wParam == IDOK)
507  {
508  g_terminated = TRUE;
509  EndDialog(hwnd, 0);
510  return 0;
511  }
512  else if (wParam == IDCANCEL)
513  {
514  EndDialog(hwnd, 0);
515  return 0;
516  }
517  break;
518  }
519 
520  return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
521 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define assert(x)
Definition: debug.h:53
#define VK_RETURN
Definition: winuser.h:2176
WPARAM wParam
Definition: combotst.c:138
#define DM_GETDEFID
Definition: winuser.h:2080
#define DC_HASDEFID
Definition: winuser.h:2584
#define WM_KEYDOWN
Definition: winuser.h:1697
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
static BOOL g_terminated
Definition: dialog.c:59
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2126
#define HIWORD(l)
Definition: typedefs.h:246
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by test_DisabledDialogTest().

◆ dlg_test_aw_message()

static void dlg_test_aw_message ( HWND  hdlg,
UINT  msg 
)
static

Definition at line 1385 of file dialog.c.

1386 {
1387  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SNDMSGA));
1388  SendMessageA(hdlg, msg, 0, (LPARAM)testtext);
1389 
1390  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SNDMSGW));
1391  SendMessageW(hdlg, msg, 0, (LPARAM)testtextW);
1392 
1393  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_DLGPROCA));
1394  DefDlgProcA(hdlg, msg, 0, (LPARAM)testtext);
1395 
1396  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_DLGPROCW));
1397  DefDlgProcW(hdlg, msg, 0, (LPARAM)testtextW);
1398 }
#define ULongToHandle(h)
Definition: basetsd.h:81
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI DefDlgProcW(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1722
LONG_PTR LPARAM
Definition: windef.h:208
LRESULT WINAPI DefDlgProcA(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1662
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
static const WCHAR testtextW[]
Definition: dialog.c:1264
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define msg(x)
Definition: auth_time.c:54
static const char * testtext
Definition: dialog.c:1265

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

◆ focusDlgWinProc()

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

Definition at line 858 of file dialog.c.

860 {
861  switch (uiMsg)
862  {
863  case WM_INITDIALOG:
864  SetWindowTextA(GetDlgItem(hDlg, 200), "new caption");
865  return TRUE;
866 
867  case WM_COMMAND:
868  if (LOWORD(wParam) == 200)
869  {
870  if (HIWORD(wParam) == EN_SETFOCUS)
872  }
873  return FALSE;
874  }
875 
876  return FALSE;
877 }
#define TRUE
Definition: types.h:120
HANDLE HWND
Definition: compat.h:13
WPARAM wParam
Definition: combotst.c:138
#define EN_SETFOCUS
Definition: winuser.h:2009
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define WM_COMMAND
Definition: winuser.h:1722
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2126
#define HIWORD(l)
Definition: typedefs.h:246
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
static HWND g_hwndInitialFocusT1
Definition: dialog.c:54

Referenced by test_focus().

◆ FormEnterMsg()

static void FormEnterMsg ( MSG pMsg,
HWND  hwnd 
)
static

Definition at line 232 of file dialog.c.

233 {
234  pMsg->hwnd = hwnd;
235  pMsg->message = WM_KEYDOWN;
236  pMsg->wParam = VK_RETURN;
237  pMsg->lParam = KeyDownData (1, 0x1C, 0, 0);
238  /* pMsg->time is not set. It shouldn't be needed */
239  /* pMsg->pt is ignored */
240 }
#define VK_RETURN
Definition: winuser.h:2176
#define WM_KEYDOWN
Definition: winuser.h:1697
static HWND hwnd[MAXHWNDS]
Definition: dialog.c:47
static DWORD KeyDownData(int repeat, int scancode, int extended, int wasdown)
Definition: dialog.c:214

Referenced by test_IsDialogMessage(), and test_WM_NEXTDLGCTL().

◆ FormTabMsg()

static void FormTabMsg ( MSG pMsg,
HWND  hwnd 
)
static

Definition at line 221 of file dialog.c.

222 {
223  pMsg->hwnd = hwnd;
224  pMsg->message = WM_KEYDOWN;
225  pMsg->wParam = VK_TAB;
226  pMsg->lParam = KeyDownData (1, 0x0F, 0, 0);
227  /* pMsg->time is not set. It shouldn't be needed */
228  /* pMsg->pt is ignored */
229 }
#define VK_TAB
Definition: winuser.h:2174
#define WM_KEYDOWN
Definition: winuser.h:1697
static HWND hwnd[MAXHWNDS]
Definition: dialog.c:47
static DWORD KeyDownData(int repeat, int scancode, int extended, int wasdown)
Definition: dialog.c:214

Referenced by test_IsDialogMessage().

◆ GetHwndString()

static const char* GetHwndString ( HWND  hw)
static

Definition at line 880 of file dialog.c.

881 {
882  if (hw == NULL)
883  return "a null handle";
884  if (hw == g_hwndMain)
885  return "the dialog handle";
886  if (hw == g_hwndInitialFocusGroupBox)
887  return "the group box control";
888  if (hw == g_hwndButton1)
889  return "the first button";
890  if (hw == g_hwndButton2)
891  return "the second button";
892  if (hw == g_hwndButtonCancel)
893  return "the cancel button";
894 
895  return "unknown handle";
896 }
static HWND g_hwndButtonCancel
Definition: dialog.c:52
smooth NULL
Definition: ftsmooth.c:416
static HWND g_hwndInitialFocusGroupBox
Definition: dialog.c:54
static HWND g_hwndMain
Definition: dialog.c:52
static HWND g_hwndButton1
Definition: dialog.c:52
static HWND g_hwndButton2
Definition: dialog.c:52

Referenced by test_focus().

◆ hook_proc()

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

Definition at line 738 of file dialog.c.

739 {
740  ok(0, "unexpected hook called, code %d\n", code);
741  return CallNextHookEx(NULL, code, wParam, lParam);
742 }
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
LPARAM lParam
Definition: combotst.c:139

Referenced by test_IsDialogMessage().

◆ hook_proc2()

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

Definition at line 745 of file dialog.c.

746 {
747  ok(code == MSGF_DIALOGBOX, "unexpected hook called, code %d\n", code);
749  return CallNextHookEx(NULL, code, wParam, lParam);
750 }
#define MSGF_DIALOGBOX
Definition: winuser.h:1159
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
static BOOL g_MSGF_DIALOGBOX
Definition: dialog.c:744
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
LPARAM lParam
Definition: combotst.c:139

Referenced by test_IsDialogMessage().

◆ id()

static int id ( HWND  h)
static

Definition at line 258 of file dialog.c.

259 {
260  unsigned int i;
261  for (i = 0; i < numwnds; i++)
262  if (hwnd[i] == h)
263  return i;
264  return -1;
265 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
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
static unsigned int numwnds
Definition: dialog.c:48

Referenced by DIALOG_GetControl32().

◆ KeyDownData()

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

Definition at line 214 of file dialog.c.

215 {
216  return ((repeat & 0x0000FFFF) | ((scancode & 0x00FF) << 16) |
217  (extended ? 0x01000000 : 0) | (wasdown ? 0x40000000 : 0));
218 }
static int repeat
Definition: xmllint.c:143

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

461 {
462  switch (uiMsg)
463  {
464  /* Add blank case statements for these to ensure we don't use them
465  * by mistake.
466  */
467  case DM_GETDEFID: break;
468  case DM_SETDEFID: break;
469 
470  case WM_CREATE:
471  return (OnMainWindowCreate (hwnd,
472  (LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1);
473  case WM_COMMAND:
474  if (wParam == IDCANCEL)
475  {
476  g_terminated = TRUE;
477  return 0;
478  }
479  break;
480  }
481 
482  return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
483 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define DM_SETDEFID
Definition: winuser.h:2081
WPARAM wParam
Definition: combotst.c:138
#define DM_GETDEFID
Definition: winuser.h:2080
static BOOL OnMainWindowCreate(HWND hwnd, LPCREATESTRUCTA lpcs)
Definition: dialog.c:408
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static BOOL g_terminated
Definition: dialog.c:59
#define WM_CREATE
Definition: winuser.h:1590
#define IDCANCEL
Definition: winuser.h:825
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139

Referenced by RegisterWindowClasses().

◆ messageBoxFontDlgWinProc()

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

Definition at line 1774 of file dialog.c.

1776 {
1777  if (uiMsg == WM_INITDIALOG) {
1778  SetFocus(hDlg);
1779  return 1;
1780  }
1781 
1782  return 0;
1783 }
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WM_INITDIALOG
Definition: winuser.h:1721

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

2003 {
2004  if (code == HCBT_ACTIVATE)
2005  {
2006  HWND msgbox = (HWND)wParam, msghwnd;
2007  char text[64];
2008 
2009  if (msgbox)
2010  {
2011  text[0] = 0;
2012  GetWindowTextA(msgbox, text, sizeof(text));
2013  ok(!strcmp(text, "MSGBOX caption"), "Unexpected window text \"%s\"\n", text);
2014 
2015  msghwnd = GetDlgItem(msgbox, 0xffff);
2016  ok(msghwnd != NULL, "Expected static control\n");
2017 
2018  text[0] = 0;
2019  GetWindowTextA(msghwnd, text, sizeof(text));
2020  ok(!strcmp(text, "Text"), "Unexpected window text \"%s\"\n", text);
2021 
2023  SendDlgItemMessageA(msgbox, IDCANCEL, WM_LBUTTONUP, 0, 0);
2024  }
2025  }
2026 
2027  return CallNextHookEx(NULL, code, wParam, lParam);
2028 }
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
const WCHAR * text
Definition: package.c:1827
HANDLE HWND
Definition: compat.h:13
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
LRESULT WINAPI SendDlgItemMessageA(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:2693
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#define WM_LBUTTONUP
Definition: winuser.h:1759
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2126
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define HCBT_ACTIVATE
Definition: winuser.h:60
#define IDCANCEL
Definition: winuser.h:825
LPARAM lParam
Definition: combotst.c:139

Referenced by test_MessageBox().

◆ OnMainWindowCreate()

static BOOL OnMainWindowCreate ( HWND  hwnd,
LPCREATESTRUCTA  lpcs 
)
static

Definition at line 408 of file dialog.c.

409 {
410  g_hwndButton1 = CreateWindowA("button", "Button &1",
412  10, 10, 80, 80, hwnd, (HMENU)100, g_hinst, 0);
413  if (!g_hwndButton1) return FALSE;
414 
415  g_hwndButton2 = CreateWindowA("button", "Button &2",
417  110, 10, 80, 80, hwnd, (HMENU)200, g_hinst, 0);
418  if (!g_hwndButton2) return FALSE;
419 
420  g_hwndButtonCancel = CreateWindowA("button", "Cancel",
422  210, 10, 80, 80, hwnd, (HMENU)IDCANCEL, g_hinst, 0);
423  if (!g_hwndButtonCancel) return FALSE;
424 
425  return TRUE;
426 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
static HWND g_hwndButtonCancel
Definition: dialog.c:52
#define BS_TEXT
Definition: winuser.h:276
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
#define WS_CHILD
Definition: pedump.c:617
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
#define WS_TABSTOP
Definition: pedump.c:634
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define IDCANCEL
Definition: winuser.h:825
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static HWND g_hwndButton1
Definition: dialog.c:52
static HINSTANCE g_hinst
Definition: dialog.c:51
static HWND g_hwndButton2
Definition: dialog.c:52

Referenced by main_window_procA().

◆ OnTestDlgCreate()

static BOOL OnTestDlgCreate ( HWND  hwnd,
LPCREATESTRUCTA  lpcs 
)
static

Definition at line 433 of file dialog.c.

434 {
437  "Edit", "Edit",
439  16,33,184,24, hwnd, (HMENU)101, g_hinst, 0);
440  if (!g_hwndTestDlgEdit) return FALSE;
441 
444  "button", "Button &1",
446  204,33,30,24, hwnd, (HMENU)201, g_hinst, 0);
447  if (!g_hwndTestDlgBut1) return FALSE;
448 
450  | WS_EX_NOPARENTNOTIFY, "button",
451  "Button &2",
453  90,102,80,24, hwnd, (HMENU)IDCANCEL, g_hinst, 0);
454  if (!g_hwndTestDlgBut2) return FALSE;
455 
456  return TRUE;
457 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HWND g_hwndTestDlgBut1
Definition: dialog.c:53
#define TRUE
Definition: types.h:120
static HWND g_hwndTestDlgBut2
Definition: dialog.c:53
#define WS_EX_LTRREADING
Definition: winuser.h:393
#define BS_TEXT
Definition: winuser.h:276
static HWND g_hwndTestDlgEdit
Definition: dialog.c:53
#define WS_CHILDWINDOW
Definition: pedump.c:639
#define WS_EX_LEFT
Definition: winuser.h:391
#define WS_TABSTOP
Definition: pedump.c:634
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define WS_EX_RIGHTSCROLLBAR
Definition: winuser.h:401
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define IDCANCEL
Definition: winuser.h:825
#define ES_LEFT
Definition: pedump.c:664
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define ES_AUTOHSCROLL
Definition: pedump.c:672
static HINSTANCE g_hinst
Definition: dialog.c:51

Referenced by testDlgWinProc().

◆ RegisterWindowClasses()

static BOOL RegisterWindowClasses ( void  )
static

Definition at line 564 of file dialog.c.

565 {
566  WNDCLASSA cls;
567 
568  cls.style = 0;
570  cls.cbClsExtra = 0;
571  cls.cbWndExtra = 0;
572  cls.hInstance = g_hinst;
573  cls.hIcon = NULL;
575  cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
576  cls.lpszMenuName = NULL;
577  cls.lpszClassName = "GetNextDlgItemWindowClass";
578 
579  if (!RegisterClassA (&cls)) return FALSE;
580 
582  cls.lpszClassName = "IsDialogMessageWindowClass";
583  if (!RegisterClassA (&cls)) return FALSE;
584 
586  cls.lpszClassName = "TESTCONTROL";
587  if (!RegisterClassA (&cls)) return FALSE;
588 
589  GetClassInfoA(0, "#32770", &cls);
591  cls.lpszClassName = "WM_NEXTDLGCTLWndClass";
592  if (!RegisterClassA (&cls)) return FALSE;
593 
594  return TRUE;
595 }
#define TRUE
Definition: types.h:120
int cbClsExtra
Definition: winuser.h:3139
LPCSTR lpszMenuName
Definition: winuser.h:3145
HBRUSH hbrBackground
Definition: winuser.h:3144
#define COLOR_WINDOW
Definition: winuser.h:908
int cbWndExtra
Definition: winuser.h:3140
BOOL WINAPI GetClassInfoA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSA)
HCURSOR hCursor
Definition: winuser.h:3143
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
static LRESULT CALLBACK test_control_procA(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:544
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpszClassName
Definition: winuser.h:3146
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT style
Definition: winuser.h:3137
static LRESULT CALLBACK main_window_procA(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:459
HINSTANCE hInstance
Definition: winuser.h:3141
static LRESULT CALLBACK testDlgWinProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:523
WNDPROC lpfnWndProc
Definition: winuser.h:3138
#define IDC_ARROW
Definition: winuser.h:682
static HINSTANCE g_hinst
Definition: dialog.c:51
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3142

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dialog  )

Definition at line 2162 of file dialog.c.

2163 {
2164  g_hinst = GetModuleHandleA (0);
2165 
2166  if (!RegisterWindowClasses()) assert(0);
2167 
2172  test_focus();
2173  test_GetDlgItem();
2180  test_MessageBox();
2181 }
static void test_DisabledDialogTest(void)
Definition: dialog.c:1767
static void test_GetNextDlgItem(void)
Definition: dialog.c:345
static void test_SaveRestoreFocus(void)
Definition: dialog.c:1872
static void test_WM_NEXTDLGCTL(void)
Definition: dialog.c:597
static void test_DialogBoxParam(void)
Definition: dialog.c:1696
#define assert(x)
Definition: debug.h:53
static void test_GetDlgItemText(void)
Definition: dialog.c:1067
static void test_GetDlgItem(void)
Definition: dialog.c:1080
static void test_MessageBoxFontTest(void)
Definition: dialog.c:1785
static void test_MessageBox(void)
Definition: dialog.c:2078
static void test_IsDialogMessage(void)
Definition: dialog.c:752
static void test_focus(void)
Definition: dialog.c:898
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
static BOOL RegisterWindowClasses(void)
Definition: dialog.c:564
static void test_dialog_custom_data(void)
Definition: dialog.c:2157
static void test_timer_message(void)
Definition: dialog.c:1997
static HINSTANCE g_hinst
Definition: dialog.c:51

◆ test_aw_conversion_dlgproc()

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

Definition at line 1400 of file dialog.c.

1401 {
1402  ULONG_PTR dlgproc, originalproc;
1403  WCHAR buffW[64];
1404  char buff[64];
1405  BOOL ret;
1406  INT len;
1407 
1408  switch (msg)
1409  {
1410  case WM_INITDIALOG:
1411  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1412 
1415  dlg_test_aw_message(hdlg, CB_DIR);
1416  dlg_test_aw_message(hdlg, LB_DIR);
1420 
1421  /* WM_SETTEXT/WM_GETTEXT */
1422  originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1423  ok(originalproc == (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", originalproc);
1424 
1425  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1426  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", dlgproc);
1427 
1429  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1430 
1431  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1432  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1433 
1434  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1435  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1436 
1437  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1438  ret = SetWindowTextA(hdlg, testtext);
1439  todo_wine
1440  ok(ret, "Failed to set window text.\n");
1441 
1442  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1443  ret = SetWindowTextW(hdlg, testtextW);
1444  todo_wine
1445  ok(ret, "Failed to set window text.\n");
1446 
1447  memset(buff, 'A', sizeof(buff));
1448  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1449  ok(buff[0] == 0 && buff[1] == 'A' && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1450  (BYTE)buff[0], (BYTE)buff[1], len);
1451 
1452  memset(buffW, 0xff, sizeof(buffW));
1453  len = GetWindowTextW(hdlg, buffW, 64);
1454  ok(!lstrcmpW(buffW, testtextW) && len == 0, "Unexpected window text %s, len %d\n", wine_dbgstr_w(buffW), len);
1455 
1458  dlg_test_aw_message(hdlg, CB_DIR);
1459  dlg_test_aw_message(hdlg, LB_DIR);
1463 
1465  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1466 
1467  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1468  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1469 
1470  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1471  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1472 
1473  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1474  ret = SetWindowTextA(hdlg, testtext);
1475  todo_wine
1476  ok(ret, "Failed to set window text.\n");
1477 
1478  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1479  ret = SetWindowTextW(hdlg, testtextW);
1480  todo_wine
1481  ok(ret, "Failed to set window text.\n");
1482 
1483  memset(buff, 'A', sizeof(buff));
1484  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1485  ok(buff[0] == 0 && buff[1] == 'A' && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1486  (BYTE)buff[0], (BYTE)buff[1], len);
1487 
1488  memset(buffW, 0xff, sizeof(buffW));
1489  len = GetWindowTextW(hdlg, buffW, sizeof(buffW)/sizeof(buffW[0]));
1490  ok(buffW[0] == 'W' && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1491  buffW[0], buffW[1], len);
1492 
1495  dlg_test_aw_message(hdlg, CB_DIR);
1496  dlg_test_aw_message(hdlg, LB_DIR);
1500 
1501  SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
1502  EndDialog(hdlg, -123);
1503  return TRUE;
1504  }
1505  return FALSE;
1506 }
#define ULongToHandle(h)
Definition: basetsd.h:81
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:2015
#define DWLP_DLGPROC
Definition: winuser.h:865
#define LB_ADDFILE
Definition: winuser.h:2012
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4730
int32_t INT
Definition: typedefs.h:56
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1385
uint32_t ULONG_PTR
Definition: typedefs.h:63
static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1337
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_WININICHANGE
Definition: winuser.h:1612
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define WM_SETTEXT
Definition: winuser.h:1599
#define GetWindowLongPtrA
Definition: winuser.h:4729
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
int ret
#define todo_wine
Definition: test.h:154
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
GLenum GLsizei len
Definition: glext.h:6722
#define SetWindowLongPtrA
Definition: winuser.h:5246
unsigned char BYTE
Definition: mem.h:68
static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1287
static const WCHAR testtextW[]
Definition: dialog.c:1264
static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1400
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
#define CB_DIR
Definition: winuser.h:1920
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define memset(x, y, z)
Definition: compat.h:39
#define WM_INITDIALOG
Definition: winuser.h:1721
static unsigned char buff[32768]
Definition: fatten.c:17
static const char * testtext
Definition: dialog.c:1265
#define EM_REPLACESEL
Definition: winuser.h:1988

Referenced by 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 1508 of file dialog.c.

1509 {
1510  ULONG_PTR dlgproc, originalproc;
1511  WCHAR buffW[64];
1512  char buff[64];
1513  BOOL ret;
1514  INT len;
1515 
1516  switch (msg)
1517  {
1518  case WM_INITDIALOG:
1519  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1520 
1523  dlg_test_aw_message(hdlg, CB_DIR);
1524  dlg_test_aw_message(hdlg, LB_DIR);
1528 
1529  originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1530  ok(originalproc != (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#lx.\n", originalproc);
1531 
1532  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1533  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#lx.\n", dlgproc);
1534 
1536  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1537 
1538  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1539  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1540 
1541  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1542  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1543 
1544  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1545  ret = SetWindowTextA(hdlg, testtext);
1546  todo_wine
1547  ok(ret, "Failed to set window text.\n");
1548 
1549  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1550  ret = SetWindowTextW(hdlg, testtextW);
1551  todo_wine
1552  ok(ret, "Failed to set window text.\n");
1553 
1554  memset(buff, 'A', sizeof(buff));
1555  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1556  ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
1557 
1558  memset(buffW, 0xff, sizeof(buffW));
1559  len = GetWindowTextW(hdlg, buffW, 64);
1560  ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %s, len %d\n",
1561  wine_dbgstr_w(buffW), len);
1562 
1565  dlg_test_aw_message(hdlg, CB_DIR);
1566  dlg_test_aw_message(hdlg, LB_DIR);
1570 
1572  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1573 
1574  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1575  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1576 
1577  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1578  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1579 
1580  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1581  ret = SetWindowTextA(hdlg, testtext);
1582  todo_wine
1583  ok(ret, "Failed to set window text.\n");
1584 
1585  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1586  ret = SetWindowTextW(hdlg, testtextW);
1587  todo_wine
1588  ok(ret, "Failed to set window text.\n");
1589 
1590  memset(buff, 'A', sizeof(buff));
1591  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1592  ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
1593 
1594  memset(buffW, 0xff, sizeof(buffW));
1595  len = GetWindowTextW(hdlg, buffW, sizeof(buffW)/sizeof(buffW[0]));
1596  ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1597  buffW[0], buffW[1], len);
1598 
1601  dlg_test_aw_message(hdlg, CB_DIR);
1602  dlg_test_aw_message(hdlg, LB_DIR);
1606 
1607  SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
1608  EndDialog(hdlg, -123);
1609  return TRUE;
1610  }
1611  return FALSE;
1612 }
#define ULongToHandle(h)
Definition: basetsd.h:81
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:2015
#define DWLP_DLGPROC
Definition: winuser.h:865
#define LB_ADDFILE
Definition: winuser.h:2012
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4730
int32_t INT
Definition: typedefs.h:56
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1385
uint32_t ULONG_PTR
Definition: typedefs.h:63
static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1337
unsigned int BOOL
Definition: ntddk_ex.h:94
#define WM_WININICHANGE
Definition: winuser.h:1612
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define WM_SETTEXT
Definition: winuser.h:1599
#define GetWindowLongPtrA
Definition: winuser.h:4729
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
int ret
#define todo_wine
Definition: test.h:154
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
GLenum GLsizei len
Definition: glext.h:6722
#define SetWindowLongPtrA
Definition: winuser.h:5246
static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1287
static const WCHAR testtextW[]
Definition: dialog.c:1264
static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1508
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
#define CB_DIR
Definition: winuser.h:1920
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define memset(x, y, z)
Definition: compat.h:39
#define WM_INITDIALOG
Definition: winuser.h:1721
static unsigned char buff[32768]
Definition: fatten.c:17
static const char * testtext
Definition: dialog.c:1265
#define EM_REPLACESEL
Definition: winuser.h:1988

Referenced by 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 1656 of file dialog.c.

1657 {
1658  BOOL is_unicode = !!lparam;
1659  LONG_PTR oldproc;
1660 
1661  switch (msg)
1662  {
1663  case WM_INITDIALOG:
1664  ok(is_unicode == IsWindowUnicode(hdlg), "Unexpected unicode window property.\n");
1665 
1667  SetWindowLongPtrA(hdlg, GWLP_USERDATA, oldproc);
1668  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1669 
1672  dlg_test_aw_message(hdlg, CB_DIR);
1673  dlg_test_aw_message(hdlg, LB_DIR);
1677 
1679  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1680 
1683  dlg_test_aw_message(hdlg, CB_DIR);
1684  dlg_test_aw_message(hdlg, LB_DIR);
1688 
1689  SetWindowLongPtrA(hdlg, GWLP_WNDPROC, oldproc);
1690  EndDialog(hdlg, -123);
1691  return TRUE;
1692  }
1693  return FALSE;
1694 }
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:2015
#define LB_ADDFILE
Definition: winuser.h:2012
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1385
unsigned int BOOL
Definition: ntddk_ex.h:94
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define GWLP_USERDATA
Definition: treelist.c:63
#define WM_WININICHANGE
Definition: winuser.h:1612
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define WM_SETTEXT
Definition: winuser.h:1599
#define SetWindowLongPtrA
Definition: winuser.h:5246
static LRESULT CALLBACK test_aw_conversion_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1614
#define GWLP_WNDPROC
Definition: treelist.c:66
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
#define CB_DIR
Definition: winuser.h:1920
#define ok(value,...)
Definition: atltest.h:57
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define msg(x)
Definition: auth_time.c:54
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define WM_INITDIALOG
Definition: winuser.h:1721
#define EM_REPLACESEL
Definition: winuser.h:1988

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

1288 {
1289  int mode = HandleToULong(GetPropA(hdlg, "test_mode"));
1290  WCHAR *text = (WCHAR *)lparam;
1291  char *textA = (char *)lparam;
1292 
1293  switch (msg)
1294  {
1295  case WM_SETTEXT:
1296  case WM_WININICHANGE:
1297  case WM_DEVMODECHANGE:
1298  case CB_DIR:
1299  case LB_DIR:
1300  case LB_ADDFILE:
1301  case EM_REPLACESEL:
1302  switch (mode)
1303  {
1304  case DLGPROCTEXT_DLGPROCA:
1305  ok(textA == testtext, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A",
1306  testmodes[mode], textA);
1307  break;
1308  case DLGPROCTEXT_DLGPROCW:
1309  ok(text == testtextW, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A", testmodes[mode],
1310  wine_dbgstr_w(text));
1311  break;
1312  case DLGPROCTEXT_SNDMSGA:
1313  case DLGPROCTEXT_SETTEXTA:
1314  if (IsWindowUnicode(hdlg))
1315  {
1317  "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1318  }
1319  else
1320  ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1321  break;
1322  case DLGPROCTEXT_SNDMSGW:
1323  case DLGPROCTEXT_SETTEXTW:
1324  if (IsWindowUnicode(hdlg))
1325  ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1326  else
1327  ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1328  testmodes[mode], textA);
1329  break;
1330  }
1331  break;
1332  };
1333 
1334  return DefWindowProcW(hdlg, msg, wparam, lparam);
1335 }
#define LB_DIR
Definition: winuser.h:2015
#define LB_ADDFILE
Definition: winuser.h:2012
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
const WCHAR * text
Definition: package.c:1827
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
#define HandleToULong(h)
Definition: basetsd.h:95
static const char * testmodes[]
Definition: dialog.c:1277
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define WM_WININICHANGE
Definition: winuser.h:1612
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define WM_SETTEXT
Definition: winuser.h:1599
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const char textA[]
Definition: registrar.c:40
GLenum mode
Definition: glext.h:6217
static const WCHAR testtextW[]
Definition: dialog.c:1264
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define CB_DIR
Definition: winuser.h:1920
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static const char * testtext
Definition: dialog.c:1265
#define EM_REPLACESEL
Definition: winuser.h:1988
static UINT WPARAM wparam
Definition: combo.c:716

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

1338 {
1339  int mode = HandleToULong(GetPropA(hdlg, "test_mode"));
1340  WCHAR *text = (WCHAR *)lparam;
1341  char *textA = (char *)lparam;
1342 
1343  switch (msg)
1344  {
1345  case WM_SETTEXT:
1346  case WM_WININICHANGE:
1347  case WM_DEVMODECHANGE:
1348  case CB_DIR:
1349  case LB_DIR:
1350  case LB_ADDFILE:
1351  case EM_REPLACESEL:
1352  switch (mode)
1353  {
1354  case DLGPROCTEXT_DLGPROCA:
1355  ok(textA == testtext, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A",
1356  testmodes[mode], textA);
1357  break;
1358  case DLGPROCTEXT_DLGPROCW:
1359  ok(text == testtextW, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A", testmodes[mode],
1360  wine_dbgstr_w(text));
1361  break;
1362  case DLGPROCTEXT_SNDMSGA:
1363  case DLGPROCTEXT_SETTEXTA:
1364  if (IsWindowUnicode(hdlg))
1366  "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1367  else
1368  ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1369  break;
1370  case DLGPROCTEXT_SNDMSGW:
1371  case DLGPROCTEXT_SETTEXTW:
1372  if (IsWindowUnicode(hdlg))
1373  ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1374  else
1375  ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1376  testmodes[mode], textA);
1377  break;
1378  }
1379  break;
1380  }
1381 
1382  return DefWindowProcA(hdlg, msg, wparam, lparam);
1383 }
#define LB_DIR
Definition: winuser.h:2015
#define LB_ADDFILE
Definition: winuser.h:2012
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
const WCHAR * text
Definition: package.c:1827
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
#define HandleToULong(h)
Definition: basetsd.h:95
static const char * testmodes[]
Definition: dialog.c:1277
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define WM_WININICHANGE
Definition: winuser.h:1612
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define WM_SETTEXT
Definition: winuser.h:1599
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const char textA[]
Definition: registrar.c:40
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLenum mode
Definition: glext.h:6217
static const WCHAR testtextW[]
Definition: dialog.c:1264
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define CB_DIR
Definition: winuser.h:1920
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static const char * testtext
Definition: dialog.c:1265
#define EM_REPLACESEL
Definition: winuser.h:1988
static UINT WPARAM wparam
Definition: combo.c:716

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

1615 {
1617  int mode = HandleToULong(GetPropA(hwnd, "test_mode"));
1618  WCHAR *text = (WCHAR *)lparam;
1619  char *textA = (char *)lparam;
1620 
1621  switch (msg)
1622  {
1623  case WM_SETTEXT:
1624  case WM_WININICHANGE:
1625  case WM_DEVMODECHANGE:
1626  case CB_DIR:
1627  case LB_DIR:
1628  case LB_ADDFILE:
1629  case EM_REPLACESEL:
1630  switch (mode)
1631  {
1632  case DLGPROCTEXT_SNDMSGA:
1633  if (IsWindowUnicode(hwnd))
1635  "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1636  else
1637  ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1638  break;
1639  case DLGPROCTEXT_SNDMSGW:
1640  if (IsWindowUnicode(hwnd))
1641  ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1642  else
1643  ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1644  testmodes[mode], textA);
1645  break;
1646  default:
1647  ok(0, "Unexpected test mode %d.\n", mode);
1648  }
1649  break;
1650  }
1651 
1652  return IsWindowUnicode(hwnd) ? CallWindowProcW(oldproc, hwnd, msg, wparam, lparam) :
1653  CallWindowProcA(oldproc, hwnd, msg, wparam, lparam);
1654 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define LB_DIR
Definition: winuser.h:2015
#define LB_ADDFILE
Definition: winuser.h:2012
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
const WCHAR * text
Definition: package.c:1827
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
#define HandleToULong(h)
Definition: basetsd.h:95
static const char * testmodes[]
Definition: dialog.c:1277
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define GWLP_USERDATA
Definition: treelist.c:63
#define WM_WININICHANGE
Definition: winuser.h:1612
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define WM_SETTEXT
Definition: winuser.h:1599
#define GetWindowLongPtrA
Definition: winuser.h:4729
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const char textA[]
Definition: registrar.c:40
GLenum mode
Definition: glext.h:6217
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
static const WCHAR testtextW[]
Definition: dialog.c:1264
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define CB_DIR
Definition: winuser.h:1920
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static const char * testtext
Definition: dialog.c:1265
#define EM_REPLACESEL
Definition: winuser.h:1988
static UINT WPARAM wparam
Definition: combo.c:716

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

545 {
546  switch(msg)
547  {
548  case WM_CREATE:
549  {
550  static const short sample[] = { 10,1,2,3,4,5 };
552  short *data = cs->lpCreateParams;
553  ok(!memcmp(data, sample, sizeof(sample)), "data mismatch: %d,%d,%d,%d,%d\n", data[0], data[1], data[2], data[3], data[4]);
554  }
555  return 0;
556 
557  default:
558  break;
559  }
560 
561  return DefWindowProcA(hwnd, msg, wparam, lparam);
562 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
uint32_t cs
Definition: isohybrid.c:75
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define WM_CREATE
Definition: winuser.h:1590
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by RegisterWindowClasses().

◆ test_dialog_custom_data()

static void test_dialog_custom_data ( void  )
static

Definition at line 2157 of file dialog.c.

2158 {
2159  DialogBoxA(g_hinst, "CUSTOM_TEST_DIALOG", NULL, custom_test_dialog_proc);
2160 }
#define DialogBoxA(i, t, p, f)
Definition: winuser.h:4299
smooth NULL
Definition: ftsmooth.c:416
static INT_PTR CALLBACK custom_test_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:2149
static HINSTANCE g_hinst
Definition: dialog.c:51

Referenced by START_TEST().

◆ test_DialogBoxParam()

static void test_DialogBoxParam ( void  )
static

Definition at line 1696 of file dialog.c.

1697 {
1698  static const WCHAR nameW[] = {'T','E','S','T','_','E','M','P','T','Y','_','D','I','A','L','O','G',0};
1699  INT_PTR ret;
1700  HWND hwnd_invalid = (HWND)0x4444;
1701 
1702  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DLG_CHILD_POPUP", 0, TestControlStyleDlgProc, 0);
1703  ok(ret == -7, "expected -7, got %ld\n", ret);
1704 
1705  SetLastError(0xdeadbeef);
1706  ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_DIALOG" , hwnd_invalid, 0 , 0);
1707  ok(0 == ret || broken(ret == -1), "DialogBoxParamA returned %ld, expected 0\n", ret);
1709  broken(GetLastError() == 0xdeadbeef),
1710  "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
1711 
1712  /* Test a dialog which destroys itself on WM_INITDIALOG. */
1713  SetLastError(0xdeadbeef);
1714  ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_DIALOG", 0, DestroyDlgWinProc, 0);
1715  ok(-1 == ret, "DialogBoxParamA returned %ld, expected -1\n", ret);
1717  GetLastError() == ERROR_SUCCESS ||
1718  broken(GetLastError() == 0xdeadbeef),
1719  "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
1720 
1721  /* Test a dialog which destroys itself on WM_CLOSE. */
1723  ok(0 == ret, "DialogBoxParamA returned %ld, expected 0\n", ret);
1724 
1725  SetLastError(0xdeadbeef);
1726  ret = DialogBoxParamA(GetModuleHandleA(NULL), "RESOURCE_INVALID" , 0, 0, 0);
1727  ok(-1 == ret, "DialogBoxParamA returned %ld, expected -1\n", ret);
1729  broken(GetLastError() == 0xdeadbeef),
1730  "got %d, expected ERROR_RESOURCE_NAME_NOT_FOUND\n",GetLastError());
1731 
1732  SetLastError(0xdeadbeef);
1733  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DIALOG_INVALID_CLASS", 0, DestroyDlgWinProc, 0);
1734  ok(ret == -1, "DialogBoxParamA returned %ld, expected -1\n", ret);
1735  ok(GetLastError() == 0, "got %d\n", GetLastError());
1736 
1737  SetLastError(0xdeadbeef);
1738  ret = DefDlgProcA(0, WM_ERASEBKGND, 0, 0);
1739  ok(ret == 0, "DefDlgProcA returned %ld, expected 0\n", ret);
1741  broken(GetLastError() == 0xdeadbeef),
1742  "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n", GetLastError());
1743 
1744  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestInitDialogHandleProc, 0);
1745  ok(ret == IDOK, "Expected IDOK\n");
1746 
1747  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestDefButtonDlgProc, 0);
1748  ok(ret == IDOK, "Expected IDOK\n");
1749 
1750  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestReturnKeyDlgProc, 0);
1751  ok(ret == 0, "Unexpected ret value %ld.\n", ret);
1752 
1753  /* WM_SETTEXT handling in case of A/W dialog procedures vs A/W dialog window. */
1755  ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1756 
1757  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, test_aw_conversion_dlgproc2, 0);
1758  ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1759 
1761  ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1762 
1763  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, test_aw_conversion_dlgproc3, 0);
1764  ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1765 }
static INT_PTR CALLBACK DestroyOnCloseDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1142
#define IDOK
Definition: winuser.h:824
#define ERROR_SUCCESS
Definition: deptool.c:10
static INT_PTR CALLBACK TestControlStyleDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1228
static INT_PTR CALLBACK TestReturnKeyDlgProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1188
#define ERROR_RESOURCE_NAME_NOT_FOUND
Definition: winerror.h:1121
HANDLE HWND
Definition: compat.h:13
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int32_t INT_PTR
Definition: typedefs.h:62
static INT_PTR CALLBACK test_aw_conversion_dlgproc3(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1656
smooth NULL
Definition: ftsmooth.c:416
LRESULT WINAPI DefDlgProcA(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1662
static const WCHAR nameW[]
Definition: main.c:46
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:881
__wchar_t WCHAR
Definition: xmlstorage.h:180
static INT_PTR CALLBACK TestInitDialogHandleProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1160
#define SetLastError(x)
Definition: compat.h:409
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define broken(x)
Definition: _sntprintf.h:21
INT_PTR WINAPI DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
Definition: dialog.c:1838
static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1508
static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1400
#define ok(value,...)
Definition: atltest.h:57
static INT_PTR CALLBACK DestroyDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1131
static INT_PTR CALLBACK TestDefButtonDlgProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1176
#define WM_ERASEBKGND
Definition: winuser.h:1607
INT_PTR WINAPI DialogBoxParamW(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
Definition: dialog.c:1871

Referenced by START_TEST().

◆ test_DisabledDialogTest()

static void test_DisabledDialogTest ( void  )
static

Definition at line 1767 of file dialog.c.

1768 {
1769  g_terminated = FALSE;
1770  DialogBoxParamA(g_hinst, "IDD_DIALOG", NULL, disabled_test_proc, 0);
1771  ok(FALSE == g_terminated, "dialog with disabled ok button has been terminated\n");
1772 }
static LRESULT CALLBACK disabled_test_proc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:485
smooth NULL
Definition: ftsmooth.c:416
INT_PTR WINAPI DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
Definition: dialog.c:1838
#define ok(value,...)
Definition: atltest.h:57
static BOOL g_terminated
Definition: dialog.c:59
static HINSTANCE g_hinst
Definition: dialog.c:51

Referenced by START_TEST().

◆ test_focus()

static void test_focus ( void  )
static

Definition at line 898 of file dialog.c.

899 {
900  /* Test 1:
901  * This test intentionally returns FALSE in response to WM_INITDIALOG
902  * without setting focus to a control. This is what MFC's CFormView does.
903  *
904  * Since the WM_INITDIALOG handler returns FALSE without setting the focus,
905  * the focus should initially be NULL. Later, when we manually set focus to
906  * the dialog, the default handler should set focus to the first control that
907  * is "visible, not disabled, and has the WS_TABSTOP style" (MSDN). Because the
908  * second radio button has been checked, it should be the first control
909  * that meets these criteria and should receive the focus.
910  */
911 
913  g_hwndInitialFocusT1 = (HWND) -1;
914  g_hwndInitialFocusT2 = (HWND) -1;
917 
918  DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);
919 
920  ok (((g_styleInitialFocusT1 & WS_TABSTOP) == 0),
921  "Error in wrc - Detected WS_TABSTOP as default style for GROUPBOX\n");
922 
923  ok (((g_styleInitialFocusT2 & WS_VISIBLE) == 0),
924  "Modal dialogs should not be shown until the message queue first goes empty\n");
925 
927  "Error in initial focus when WM_INITDIALOG returned FALSE: "
928  "Expected NULL focus, got %s (%p).\n",
930 
932  "Error after first SetFocus() when WM_INITDIALOG returned FALSE: "
933  "Expected the second button (%p), got %s (%p).\n",
936 
937  /* Test 2:
938  * This is the same as above, except WM_INITDIALOG is made to return TRUE.
939  * This should cause the focus to go to the second radio button right away
940  * and stay there (until the user indicates otherwise).
941  */
942 
944  g_hwndInitialFocusT1 = (HWND) -1;
945  g_hwndInitialFocusT2 = (HWND) -1;
948 
949  DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);
950 
952  "Error in initial focus when WM_INITDIALOG returned TRUE: "
953  "Expected the second button (%p), got %s (%p).\n",
956 
958  "Error after first SetFocus() when WM_INITDIALOG returned TRUE: "
959  "Expected the second button (%p), got %s (%p).\n",
962 
963  /* Test 3:
964  * If the dialog has DS_CONTROL and it's not visible then we shouldn't change focus */
965  {
966  HWND hDlg;
967  HRSRC hResource;
968  HANDLE hTemplate;
969  DLGTEMPLATE* pTemplate;
970  HWND hTextbox;
971  DWORD selectionStart = 0xdead, selectionEnd = 0xbeef;
972 
973  hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG", (LPCSTR)RT_DIALOG);
974  hTemplate = LoadResource(g_hinst, hResource);
975  pTemplate = LockResource(hTemplate);
976 
978  hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, focusDlgWinProc, 0);
979  ok (hDlg != 0, "Failed to create test dialog.\n");
980 
981  ok ((g_hwndInitialFocusT1 == 0),
982  "Focus should not be set for an invisible DS_CONTROL dialog %p.\n", g_hwndInitialFocusT1);
983 
984  /* Also make sure that WM_SETFOCUS selects the textbox's text */
985  hTextbox = GetDlgItem(hDlg, 200);
986  SendMessageA(hTextbox, WM_SETTEXT, 0, (LPARAM)"Hello world");
987 
988  SendMessageA(hDlg, WM_SETFOCUS, 0, 0);
989  SendMessageA(hTextbox, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
990  ok(selectionStart == 0 && selectionEnd == 11, "Text selection after WM_SETFOCUS is [%i, %i) expected [0, 11)\n", selectionStart, selectionEnd);
991 
992  /* but WM_ACTIVATE does not */
993  SendMessageA(hTextbox, EM_SETSEL, 0, 0);
995  SendMessageA(hTextbox, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
996  ok(selectionStart == 0 && selectionEnd == 0, "Text selection after WM_ACTIVATE is [%i, %i) expected [0, 0)\n", selectionStart, selectionEnd);
997 
998  DestroyWindow(hDlg);
999  }
1000 
1001  /* Test 4:
1002  * If the dialog has no tab-accessible controls, set focus to first control */
1003  {
1004  HWND hDlg;
1005  HRSRC hResource;
1006  HANDLE hTemplate;
1007  DLGTEMPLATE* pTemplate;
1008  HWND hLabel;
1009 
1010  hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_2", (LPCSTR)RT_DIALOG);
1011  hTemplate = LoadResource(g_hinst, hResource);
1012  pTemplate = LockResource(hTemplate);
1013 
1014  hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, focusDlgWinProc, 0);
1015  ok(hDlg != 0, "Failed to create test dialog.\n");
1016  hLabel = GetDlgItem(hDlg, 200);
1017 
1018  ok(GetFocus() == hLabel, "Focus not set to label, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1019 
1020  DestroyWindow(hDlg);
1021 
1022  /* Also check focus after WM_ACTIVATE and WM_SETFOCUS */
1023  hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, NULL, 0);
1024  ok(hDlg != 0, "Failed to create test dialog.\n");
1025  hLabel = GetDlgItem(hDlg, 200);
1026 
1027  SetFocus(NULL);
1028  SendMessageA(hDlg, WM_ACTIVATE, WA_ACTIVE, 0);
1029  ok(GetFocus() == NULL, "Focus set on WM_ACTIVATE, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1030 
1031  SetFocus(NULL);
1032  SendMessageA(hDlg, WM_SETFOCUS, 0, 0);
1033  ok(GetFocus() == hLabel, "Focus not set to label on WM_SETFOCUS, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1034 
1035  DestroyWindow(hDlg);
1036  }
1037 
1038  /* Test 5:
1039  * Select textbox's text on creation */
1040  {
1041  HWND hDlg;
1042  HRSRC hResource;
1043  HANDLE hTemplate;
1044  DLGTEMPLATE* pTemplate;
1045  HWND edit;
1046  DWORD selectionStart = 0xdead, selectionEnd = 0xbeef;
1047 
1048  hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_3", (LPCSTR)RT_DIALOG);
1049  hTemplate = LoadResource(g_hinst, hResource);
1050  pTemplate = LockResource(hTemplate);
1051 
1052  hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, focusDlgWinProc, 0);
1053  ok(hDlg != 0, "Failed to create test dialog.\n");
1054  edit = GetDlgItem(hDlg, 200);
1055 
1056  ok(GetFocus() == edit, "Focus not set to edit, focus=%p, dialog=%p, edit=%p\n",
1057  GetFocus(), hDlg, edit);
1058  SendMessageA(edit, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
1059  ok(selectionStart == 0 && selectionEnd == 11,
1060  "Text selection after WM_SETFOCUS is [%i, %i) expected [0, 11)\n",
1061  selectionStart, selectionEnd);
1062 
1063  DestroyWindow(hDlg);
1064  }
1065 }
#define TRUE
Definition: types.h:120
static HWND g_hwndInitialFocusT2
Definition: dialog.c:54
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
HANDLE HWND
Definition: compat.h:13
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND WINAPI CreateDialogIndirectParamA(HINSTANCE hInstance, LPCDLGTEMPLATE lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit)
Definition: dialog.c:1588
UINT_PTR WPARAM
Definition: windef.h:207
#define DialogBoxA(i, t, p, f)
Definition: winuser.h:4299
BOOL WINAPI DestroyWindow(_In_ HWND)
static INT_PTR CALLBACK focusDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:858
static LONG g_styleInitialFocusT1
Definition: dialog.c:56
static INT_PTR CALLBACK delayFocusDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:818
#define EM_GETSEL
Definition: winuser.h:1979
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
#define WM_SETTEXT
Definition: winuser.h:1599
#define RT_DIALOG
Definition: pedump.c:367
#define WA_ACTIVE
Definition: winuser.h:2598
#define EM_SETSEL
Definition: winuser.h:2000
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WS_TABSTOP
Definition: pedump.c:634
#define WM_ACTIVATE
Definition: winuser.h:1594
#define ok(value,...)
Definition: atltest.h:57
HWND WINAPI GetFocus(void)
Definition: window.c:1905
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2126
#define WM_SETFOCUS
Definition: winuser.h:1595
#define WS_VISIBLE
Definition: pedump.c:620
static BOOL g_bInitialFocusInitDlgResult
Definition: dialog.c:57
static const char * GetHwndString(HWND hw)
Definition: dialog.c:880
static HINSTANCE g_hinst
Definition: dialog.c:51
static HWND g_hwndButton2
Definition: dialog.c:52
static LONG g_styleInitialFocusT2
Definition: dialog.c:56
static HWND g_hwndInitialFocusT1
Definition: dialog.c:54

Referenced by START_TEST().

◆ test_GetDlgItem()

static void test_GetDlgItem ( void  )
static

Definition at line 1080 of file dialog.c.

1081 {
1082  HWND hwnd, child1, child2, hwnd2;
1083  BOOL ret;
1084 
1085  hwnd = CreateWindowA("button", "parent", WS_VISIBLE, 0, 0, 100, 100, NULL, 0, g_hinst, NULL);
1086  ok(hwnd != NULL, "failed to created window\n");
1087 
1088  /* created with the same ID */
1089  child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
1090  ok(child1 != NULL, "failed to create first child\n");
1091  child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
1092  ok(child2 != NULL, "failed to create second child\n");
1093 
1094  hwnd2 = GetDlgItem(hwnd, 0);
1095  ok(hwnd2 == child1, "expected first child, got %p\n", hwnd2);
1096 
1097  hwnd2 = GetTopWindow(hwnd);
1098  ok(hwnd2 == child1, "expected first child to be top, got %p\n", hwnd2);
1099 
1100  ret = SetWindowPos(child1, child2, 0, 0, 0, 0, SWP_NOMOVE);
1101  ok(ret, "got %d\n", ret);
1102  hwnd2 = GetTopWindow(hwnd);
1103  ok(hwnd2 == child2, "expected second child to be top, got %p\n", hwnd2);
1104 
1105  /* top window from child list is picked */
1106  hwnd2 = GetDlgItem(hwnd, 0);
1107  ok(hwnd2 == child2, "expected second child, got %p\n", hwnd2);
1108 
1109  /* Now test how GetDlgItem searches */
1110  DestroyWindow(child2);
1111  child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, child1, 0, g_hinst, NULL);
1112  ok(child2 != NULL, "failed to create second child\n");
1113 
1114  /* give child2 an ID */
1115  SetWindowLongA(child2, GWLP_ID, 100);
1116 
1117  hwnd2 = GetDlgItem(hwnd, 100);
1118  ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);
1119 
1120  /* make the ID of child2 public with a WS_EX_CONTROLPARENT parent */
1122 
1123  hwnd2 = GetDlgItem(hwnd, 100);
1124  ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);
1125 
1126  DestroyWindow(child1);
1127  DestroyWindow(child2);
1129 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define GWL_EXSTYLE
Definition: winuser.h:845
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
HWND WINAPI GetTopWindow(_In_opt_ HWND)
#define WS_EX_CONTROLPARENT
Definition: winuser.h:387
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
smooth NULL
Definition: ftsmooth.c:416
int ret
static HWND hwnd[MAXHWNDS]
Definition: dialog.c:47
#define ok(value,...)
Definition: atltest.h:57
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2126
#define SWP_NOMOVE
Definition: winuser.h:1229
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define WS_VISIBLE
Definition: pedump.c:620
static HINSTANCE g_hinst
Definition: dialog.c:51
#define GWLP_ID
Definition: winuser.h:854

Referenced by START_TEST().

◆ test_GetDlgItemText()

static void test_GetDlgItemText ( void  )
static

Definition at line 1067 of file dialog.c.

1068 {
1069  char string[64];
1070  BOOL ret;
1071 
1072  strcpy(string, "Overwrite Me");
1073  ret = GetDlgItemTextA(NULL, 0, string, sizeof(string)/sizeof(string[0]));
1074  ok(!ret, "GetDlgItemText(NULL) shouldn't have succeeded\n");
1075 
1076  ok(string[0] == '\0' || broken(!strcmp(string, "Overwrite Me")),
1077  "string retrieved using GetDlgItemText should have been NULL terminated\n");
1078 }
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
int ret
#define broken(x)
Definition: _sntprintf.h:21
UINT WINAPI GetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPSTR lpString, int nMaxCount)
Definition: dialog.c:2190
#define ok(value,...)
Definition: atltest.h:57
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by START_TEST().

◆ test_GetNextDlgItem()

static void test_GetNextDlgItem ( void  )
static

Definition at line 345 of file dialog.c.

346 {
347  static test_record test [] =
348  {
349  /* isok test dlg ctl tab prev res */
350 
351  { 1, 1, 6, 0, 0, 1, 0},
352  { 1, 2, 6, 0, 1, 1, 0},
353  { 1, 3, 6, 6, 0, 1, 0},
354  { 1, 4, 6, 6, 1, 1, 0},
355  { 1, 5, 6, 0, 0, 0, 66},
356  { 1, 6, 6, 0, 1, 0, 67},
357  { 1, 7, 6, 6, 0, 0, 66},
358  { 1, 8, 6, 6, 1, 0, 67},
359 
360  { 1, 9, 4, 83, 1, 0, 84},
361  { 1, 10, 4, 83, 0, 0, 5},
362  { 1, 11, 5, 81, 1, 0, 67},
363  { 1, 12, 5, 81, 0, 0, 66},
364  { 1, 13, 5, 82, 1, 1, 78},
365 
366  { 1, 14, 5, 82, 0, 1, 79},
367  { 1, 15, 6, 70, 0, 0, 72},
368  { 1, 16, 6, 72, 0, 0, 25},
369  { 1, 17, 6, 75, 0, 0, 26},
370  { 1, 18, 6, 77, 0, 0, 76},
371  { 1, 19, 6, 79, 0, 0, 66},
372  { 1, 20, 6, 71, 0, 0, 72},
373  { 1, 21, 6, 64, 0, 0, 66},
374 
375  { 1, 22, 6, 25, 0, 0, 70},
376  { 1, 23, 6, 68, 0, 0, 68},
377  { 1, 24, 6, 25, 0, 1, 72},
378  { 1, 25, 1, 70, 0, 0, 72},
379  /*{ 0, 26, 1, 70, 0, 1, 3}, Crashes Win95*/
380  { 1, 27, 1, 70, 1, 0, 72},
381  /*{ 0, 28, 1, 70, 1, 1, 61}, Crashes Win95*/
382 
383  { 1, 29, 6, 67, 1, 0, 72},
384  { 1, 30, 6, 72, 1, 1, 67},
385 
386  { 1, 35, 2, 0, 0, 0, 60},
387  { 1, 36, 2, 0, 1, 0, 60},
388 
389  { 0, 0, 0, 0, 0, 0, 0} /* End of test */
390  };
391  const test_record *p = test;
392 
393  ok (CreateWindows (g_hinst), "Could not create test windows\n");
394 
395  while (p->dlg)
396  {
397  HWND a;
398  a = (p->tab ? GetNextDlgTabItem : GetNextDlgGroupItem) (hwnd[p->dlg], hwnd[p->ctl], p->prev);
399  todo_wine_if (!p->isok)
400  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);
401  p++;
402  }
403 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND WINAPI GetNextDlgTabItem(HWND hDlg, HWND hCtl, BOOL bPrevious)
Definition: dialog.c:2343
_In_opt_ PSID Group
Definition: rtlfuncs.h:1606
GLdouble n
Definition: glext.h:7729
#define test
Definition: rosglue.h:37
#define a
Definition: ke_i.h:78
HWND WINAPI GetNextDlgGroupItem(HWND hDlg, HWND hCtl, BOOL bPrevious)
Definition: dialog.c:2225
#define todo_wine_if(is_todo)
Definition: test.h:155
#define d
Definition: ke_i.h:81
GLdouble s
Definition: gl.h:2039
static ATOM item
Definition: dde.c:856
GLuint in
Definition: glext.h:9616
#define ok(value,...)
Definition: atltest.h:57
static BOOL CreateWindows(HINSTANCE hinst)
Definition: dialog.c:152
GLuint res
Definition: glext.h:9613
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLfloat GLfloat p
Definition: glext.h:8902
static HINSTANCE g_hinst
Definition: dialog.c:51

Referenced by START_TEST().

◆ test_IsDialogMessage()

static void test_IsDialogMessage ( void  )
static

Definition at line 752 of file dialog.c.

753 {
754  HHOOK hook;
755  MSG msg;
756 
757  g_hwndMain = CreateWindowA("IsDialogMessageWindowClass", "IsDialogMessageWindowClass",
760  NULL, NULL, g_hinst, 0);
761 
762  assert (g_hwndMain);
765 
766  if (0)
767  {
768  /* crashes on Windows */
771  }
772 
773  /* The focus should initially be nowhere. The first TAB should take it
774  * to the first button. The second TAB should take it to the Cancel
775  * button.
776  */
777 
778  /* valid window, invalid message window */
780  FormTabMsg (&msg, (HWND)0xbeefbeef);
781  ok (!IsDialogMessageA(g_hwndMain, &msg), "expected failure\n");
782  ok(g_MSGF_DIALOGBOX, "hook wasn't called\n");
785 
788 
789  ok (!IsDialogMessageA(NULL, &msg), "expected failure\n");
790  ok (!IsDialogMessageA((HWND)0xbeefbeef, &msg), "expected failure\n");
791 
793 
794  ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle first TAB\n");
795  ok ((GetFocus() == g_hwndButton1), "Focus did not move to first button\n");
797  ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle second TAB\n");
799  "Focus did not move to cancel button\n");
801  ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
802  ok (g_terminated, "ENTER did not terminate\n");
803 
804  /* matching but invalid window handles, NULL */
806 
807  FormTabMsg (&msg, NULL);
808  ok (!IsDialogMessageA(msg.hwnd, &msg), "expected failure\n");
809 
810  /* matching but invalid window handles, not NULL */
811  FormTabMsg (&msg, (HWND)0xbeefbeef);
812  ok (!IsDialogMessageA(msg.hwnd, &msg), "expected failure\n");
813 
815 }
static HWND g_hwndButtonCancel
Definition: dialog.c:52
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WH_MSGFILTER
Definition: winuser.h:29
BOOL WINAPI IsDialogMessageA(_In_ HWND, _In_ LPMSG)
#define assert(x)
Definition: debug.h:53
HHOOK WINAPI SetWindowsHookExA(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
static void FormEnterMsg(MSG *pMsg, HWND hwnd)
Definition: dialog.c:232
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
static void FormTabMsg(MSG *pMsg, HWND hwnd)
Definition: dialog.c:221
Definition: msg.h:42
static LRESULT CALLBACK hook_proc2(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:745
static BOOL g_MSGF_DIALOGBOX
Definition: dialog.c:744
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define ok(value,...)
Definition: atltest.h:57
static HWND g_hwndMain
Definition: dialog.c:52
HWND WINAPI GetFocus(void)
Definition: window.c:1905
#define msg(x)
Definition: auth_time.c:54
static LRESULT CALLBACK hook_proc(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:738
static BOOL g_terminated
Definition: dialog.c:59
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
static HWND g_hwndButton1
Definition: dialog.c:52
static HINSTANCE g_hinst
Definition: dialog.c:51

Referenced by START_TEST().

◆ test_MessageBox()

static void test_MessageBox ( void  )
static

Definition at line 2078 of file dialog.c.

2079 {
2080  static const struct
2081  {
2082  DWORD mb_style;
2083  DWORD ex_style;
2084  } test[] =
2085  {
2086  { MB_OK, 0 },
2087  { MB_OK | MB_TASKMODAL, 0 },
2089  };
2091  HANDLE thread;
2092  DWORD tid, i;
2093  HHOOK hook;
2094  int ret;
2095 
2097 
2098  ret = MessageBoxA(NULL, "Text", "MSGBOX caption", MB_OKCANCEL);
2099  ok(ret == IDCANCEL, "got %d\n", ret);
2100 
2102 
2103  sprintf(params.caption, "pid %08x, tid %08x, time %08x",
2105 
2106  params.owner = FALSE;
2107 
2108  for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
2109  {
2110  HWND hwnd;
2111  DWORD ex_style;
2112 
2113  params.style = test[i].mb_style;
2114 
2116 
2117  hwnd = wait_for_window(params.caption);
2118  ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
2119  ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style);
2120 
2122 
2123  ok(WaitForSingleObject(thread, 5000) != WAIT_TIMEOUT, "thread failed to terminate\n");
2125  }
2126 
2127  params.owner = TRUE;
2128 
2129  for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
2130  {
2131  HWND hwnd;
2132  DWORD ex_style;
2133 
2134  params.style = test[i].mb_style;
2135 
2137 
2138  hwnd = wait_for_window(params.caption);
2139  ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
2140  ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style);
2141 
2143 
2144  ok(WaitForSingleObject(thread, 5000) != WAIT_TIMEOUT, "thread failed to terminate\n");
2146  }
2147 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_SYSTEMMODAL
Definition: winuser.h:809
#define GWL_EXSTYLE
Definition: winuser.h:845
#define test
Definition: rosglue.h:37
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
#define sprintf(buf, format,...)
Definition: sprintf.c:55
HHOOK WINAPI SetWindowsHookExA(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define GetCurrentTime
Definition: winbase.h:2049
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
GLenum const GLfloat * params
Definition: glext.h:5645
#define MB_TASKMODAL
Definition: winuser.h:810
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:136
smooth NULL
Definition: ftsmooth.c:416
#define MB_OKCANCEL
Definition: winuser.h:798
#define WH_CBT
Definition: winuser.h:35
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
Definition: msg.h:42
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_TIMEOUT
Definition: dderror.h:14
static DWORD WINAPI create_window_thread(void *param)
Definition: dialog.c:2037
static HANDLE thread
Definition: service.c:33
int ret
#define WS_EX_TOPMOST
Definition: pedump.c:647
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
static HWND hwnd[MAXHWNDS]
Definition: dialog.c:47
#define ok(value,...)
Definition: atltest.h:57
static HWND wait_for_window(const char *caption)
Definition: dialog.c:2055
static LRESULT CALLBACK msgbox_hook_proc(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:2002
#define MB_OK
Definition: winuser.h:784
#define IDCANCEL
Definition: winuser.h:825
static TfClientId tid
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158

Referenced by START_TEST().

◆ test_MessageBoxFontTest()

static void test_MessageBoxFontTest ( void  )
static

Definition at line 1785 of file dialog.c.

1786 {
1787  /* This dialog template defines a dialog template which got 0x7fff as its
1788  * font size and omits the other font members. On WinNT, passing such a
1789  * dialog template to CreateDialogIndirectParamW will result in a dialog
1790  * being created which uses the message box font. We test that here.
1791  */
1792 
1793  static unsigned char dlgTemplate[] =
1794  {
1795  /* Dialog header */
1796  0x01,0x00, /* Version */
1797  0xff,0xff, /* Extended template marker */
1798  0x00,0x00,0x00,0x00, /* Context Help ID */
1799  0x00,0x00,0x00,0x00, /* Extended style */
1800  0xc0,0x00,0xc8,0x80, /* Style (WS_SYSMENU|WS_CAPTION|WS_POPUP|DS_SETFONT|DS_MODALFRAME) */
1801  0x01,0x00, /* Control count */
1802  0x00,0x00, /* X */
1803  0x00,0x00, /* Y */
1804  0x80,0x00, /* Width */
1805  0x80,0x00, /* Height */
1806  0x00,0x00, /* Menu name */
1807  0x00,0x00, /* Class name */
1808  'T',0x00,'e',0x00, /* Caption (unicode) */
1809  's',0x00,'t',0x00,
1810  0x00,0x00,
1811  0xff,0x7f, /* Font height (0x7fff = message box font) */
1812 
1813  /* Control #1 */
1814  0x00,0x00, /* Align to DWORD (header is 42 bytes) */
1815  0x00,0x00,0x00,0x00, /* Context Help ID */
1816  0x00,0x00,0x00,0x00, /* Extended style */
1817  0x00,0x00,0x00,0x50, /* Style (WS_CHILD|WS_VISIBLE) */
1818  0x00,0x00, /* X */
1819  0x00,0x00, /* Y */
1820  0x80,0x00, /* Width */
1821  0x80,0x00, /* Height */
1822  0x00,0x01,0x00,0x00, /* Control ID (256) */
1823  0xff,0xff,0x82,0x00, /* Class (Static) */
1824  'W',0x00,'I',0x00, /* Caption (unicode) */
1825  'N',0x00,'E',0x00,
1826  ' ',0x00,'d',0x00,
1827  'i',0x00,'a',0x00,
1828  'l',0x00,'o',0x00,
1829  'g',0x00,' ',0x00,
1830  't',0x00,'e',0x00,
1831  's',0x00,'t',0x00,
1832  '.',0x00,0x00,0x00,
1833  0x00,0x00, /* Size of extended data */
1834 
1835  0x00,0x00 /* Align to DWORD */
1836  };
1837 
1838  HWND hDlg;
1839  HFONT hFont;
1840  LOGFONTW lfStaticFont;
1841  NONCLIENTMETRICSW ncMetrics;
1842 
1843  /* Check if the dialog can be created from the template. On Win9x, this should fail
1844  * because we are calling the W function which is not implemented, but that's what
1845  * we want, because passing such a template to CreateDialogIndirectParamA would crash
1846  * anyway.
1847  */
1849  if (!hDlg)
1850  {
1851  win_skip("dialog wasn't created\n");
1852  return;
1853  }
1854 
1855  hFont = (HFONT) SendDlgItemMessageW(hDlg, 256, WM_GETFONT, 0, 0);
1856  if (!hFont)
1857  {
1858  skip("dialog uses system font\n");
1859  DestroyWindow(hDlg);
1860  return;
1861  }
1862  GetObjectW(hFont, sizeof(LOGFONTW), &lfStaticFont);
1863 
1864  ncMetrics.cbSize = FIELD_OFFSET(NONCLIENTMETRICSW, iPaddedBorderWidth);
1865  SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncMetrics, 0);
1866  ok( !memcmp(&lfStaticFont, &ncMetrics.lfMessageFont, FIELD_OFFSET(LOGFONTW, lfFaceName)) &&
1867  !lstrcmpW(lfStaticFont.lfFaceName, ncMetrics.lfMessageFont.lfFaceName),
1868  "dialog doesn't use message box font\n");
1869  DestroyWindow(hDlg);
1870 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HWND WINAPI CreateDialogIndirectParamW(HINSTANCE hInstance, LPCDLGTEMPLATE lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit)
Definition: dialog.c:1604
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
BOOL WINAPI DestroyWindow(_In_ HWND)
HFONT hFont
Definition: main.c:53
smooth NULL
Definition: ftsmooth.c:416
#define WM_GETFONT
Definition: winuser.h:1633
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
LRESULT WINAPI SendDlgItemMessageW(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:2713
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define ok(value,...)
Definition: atltest.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define skip(...)
Definition: atltest.h:64
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
#define win_skip
Definition: test.h:141
static HINSTANCE g_hinst
Definition: dialog.c:51
static INT_PTR CALLBACK messageBoxFontDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1774

Referenced by START_TEST().

◆ test_SaveRestoreFocus()

static void test_SaveRestoreFocus ( void  )
static

Definition at line 1872 of file dialog.c.

1873 {
1874  HWND hDlg;
1875  HRSRC hResource;
1876  HANDLE hTemplate;
1877  DLGTEMPLATE* pTemplate;
1878  LONG_PTR foundId;
1879  HWND foundHwnd;
1880 
1881  /* create the dialog */
1882  hResource = FindResourceA(g_hinst, "MULTI_EDIT_DIALOG", (LPCSTR)RT_DIALOG);
1883  hTemplate = LoadResource(g_hinst, hResource);
1884  pTemplate = LockResource(hTemplate);
1885 
1887  ok (hDlg != 0, "Failed to create test dialog.\n");
1888 
1889  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
1890  ok (foundId == 1000, "First edit box should have gained focus on dialog creation. Expected: %d, Found: %ld\n", 1000, foundId);
1891 
1894  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
1895  ok (foundId == 1001, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);
1897 
1898  /* de- then reactivate the dialog */
1901 
1902  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
1903  ok (foundId == 1000, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1000, foundId);
1904 
1905  /* select the next tabbable item */
1907 
1908  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
1909  ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
1910 
1911  /* de- then reactivate the dialog */
1914 
1915  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
1916  ok (foundId == 1001, "Second edit box should have gained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);
1917 
1918  /* set focus to the dialog */
1919  SetFocus(hDlg);
1920 
1921  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
1922  ok (foundId == 1000, "First edit box should have gained focus on dialog focus. Expected: %d, Found: %ld\n", 1000, foundId);
1923 
1924  /* select second tabbable item */
1926 
1927  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
1928  ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
1929 
1930  /* send WM_ACTIVATE message to already active dialog */
1932 
1933  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
1934  ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
1935 
1936  /* disable the 2nd box */
1938 
1939  foundHwnd = GetFocus();
1940  ok (foundHwnd == NULL, "Second edit box should have lost focus after being disabled. Expected: %p, Found: %p\n", NULL, foundHwnd);
1941 
1942  /* de- then reactivate the dialog */
1945 
1946  foundHwnd = GetFocus();
1947  ok (foundHwnd == NULL, "No controls should have gained focus after dialog reactivation. Expected: %p, Found: %p\n", NULL, foundHwnd);
1948 
1949  /* clean up */
1950  DestroyWindow(hDlg);
1951 }
HWND WINAPI GetNextDlgTabItem(HWND hDlg, HWND hCtl, BOOL bPrevious)
Definition: dialog.c:2343
#define MAKEWPARAM(l, h)
Definition: winuser.h:3948
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND WINAPI CreateDialogIndirectParamA(HINSTANCE hInstance, LPCDLGTEMPLATE lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit)
Definition: dialog.c:1588
BOOL WINAPI DestroyWindow(_In_ HWND)
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define RT_DIALOG
Definition: pedump.c:367
#define GetWindowLongPtrA
Definition: winuser.h:4729
#define WA_ACTIVE
Definition: winuser.h:2598
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define WM_ACTIVATE
Definition: winuser.h:1594
#define ok(value,...)
Definition: atltest.h:57
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
HWND WINAPI GetFocus(void)
Definition: window.c:1905
#define WA_INACTIVE
Definition: winuser.h:2597
static HINSTANCE g_hinst
Definition: dialog.c:51
#define GWLP_ID
Definition: winuser.h:854
static INT_PTR CALLBACK messageBoxFontDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1774

Referenced by START_TEST().

◆ test_timer_message()

static void test_timer_message ( void  )
static

Definition at line 1997 of file dialog.c.

1998 {
1999  DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc);
2000 }
#define DialogBoxA(i, t, p, f)
Definition: winuser.h:4299
smooth NULL
Definition: ftsmooth.c:416
static INT_PTR CALLBACK timer_message_dlg_proc(HWND wnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1953
static HINSTANCE g_hinst
Definition: dialog.c:51

Referenced by START_TEST().

◆ test_WM_NEXTDLGCTL()

static void test_WM_NEXTDLGCTL ( void  )
static

Definition at line 597 of file dialog.c.

598 {
599  HWND child1, child2, child3;
600  MSG msg;
601  DWORD dwVal;
602 
605  "WM_NEXTDLGCTLWndClass",
606  "WM_NEXTDLGCTL Message test window",
609  0, 0, 235, 135,
610  NULL, NULL, g_hinst, 0);
611 
616 
617  /*
618  * Test message DM_SETDEFID
619  */
620 
623  dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
624 
625  ok ( IDCANCEL == (LOWORD(dwVal)), "Did not set default ID\n" );
626 
627  /*
628  * Check whether message WM_NEXTDLGCTL is changing the focus to next control and if
629  * the destination control is a button, style of the button should be changed to
630  * BS_DEFPUSHBUTTON with out making it default.
631  */
632 
633  /*
634  * Keep the focus on Edit control.
635  */
636 
637  if ( SetFocus( g_hwndTestDlgEdit ) )
638  {
639  ok ((GetFocus() == g_hwndTestDlgEdit), "Focus didn't set on Edit control\n");
640 
641  /*
642  * Test message WM_NEXTDLGCTL
643  */
645  ok ((GetFocus() == g_hwndTestDlgBut1), "Focus didn't move to first button\n");
646 
647  /*
648  * Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL"
649  */
650  dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
651  ok ( IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
652 
653  /*
654  * Check whether the style of the button which got the focus, changed to BS_DEFPUSHBUTTON and
655  * the style of default button changed to BS_PUSHBUTTON.
656  */
657  if ( IDCANCEL == (LOWORD(dwVal)) )
658  {
660  "Button1 style not set to BS_DEFPUSHBUTTON\n" );
661 
663  "Button2's style not changed to BS_PUSHBUTTON\n" );
664  }
665 
666  /*
667  * Move focus to Button2 using "WM_NEXTDLGCTL"
668  */
670  ok ((GetFocus() == g_hwndTestDlgBut2), "Focus didn't move to second button\n");
671 
672  /*
673  * Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL"
674  */
675  dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
676  ok ( IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
677 
678  /*
679  * Check whether the style of the button which got the focus, changed to BS_DEFPUSHBUTTON and
680  * the style of button which lost the focus changed to BS_PUSHBUTTON.
681  */
682  if ( IDCANCEL == (LOWORD(dwVal)) )
683  {
685  "Button2 style not set to BS_DEFPUSHBUTTON\n" );
686 
688  "Button1's style not changed to BS_PUSHBUTTON\n" );
689  }
690 
691  /*
692  * Move focus to Edit control using "WM_NEXTDLGCTL"
693  */
695  ok ((GetFocus() == g_hwndTestDlgEdit), "Focus didn't move to Edit control\n");
696 
697  /*
698  * Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL"
699  */
700  dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
701  ok ( IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
702  }
703 
704  /* test nested default buttons */
705 
706  child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 50, 50,
707  g_hwndTestDlg, (HMENU)100, g_hinst, NULL);
708  ok(child1 != NULL, "failed to create first child\n");
709  child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 60, 60, 30, 30,
710  g_hwndTestDlg, (HMENU)200, g_hinst, NULL);
711  ok(child2 != NULL, "failed to create second child\n");
712  /* create nested child */
713  child3 = CreateWindowA("button", "child3", WS_VISIBLE|WS_CHILD, 10, 10, 10, 10,
714  child1, (HMENU)300, g_hinst, NULL);
715  ok(child3 != NULL, "failed to create subchild\n");
716 
718  dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
719  ok(LOWORD(dwVal) == 200, "expected 200, got %x\n", dwVal);
720 
722  dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
723  ok(LOWORD(dwVal) == 300, "expected 300, got %x\n", dwVal);
724  ok(SendMessageW( child3, WM_GETDLGCODE, 0, 0) != DLGC_DEFPUSHBUTTON,
725  "expected child3 not to be marked as DLGC_DEFPUSHBUTTON\n");
726 
728  FormEnterMsg (&msg, child3);
729  ok(IsDialogMessageA(g_hwndTestDlg, &msg), "Did not handle the ENTER\n");
730  ok(g_bReceivedCommand, "Did not trigger the default Button action\n");
731 
732  DestroyWindow(child3);
733  DestroyWindow(child2);
734  DestroyWindow(child1);
736 }
static HWND g_hwndTestDlg
Definition: dialog.c:53
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_POPUPWINDOW
Definition: pedump.c:638
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
static HWND g_hwndTestDlgBut1
Definition: dialog.c:53
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_NEXTDLGCTL
Definition: winuser.h:1625
static HWND g_hwndTestDlgBut2
Definition: dialog.c:53
#define WS_EX_LTRREADING
Definition: winuser.h:393
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI IsDialogMessageA(_In_ HWND, _In_ LPMSG)
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
#define WS_DLGFRAME
Definition: pedump.c:626
#define assert(x)
Definition: debug.h:53
#define DM_SETDEFID
Definition: winuser.h:2081
HWND WINAPI SetFocus(_In_opt_ HWND)
#define WS_CHILD
Definition: pedump.c:617
BOOL WINAPI DestroyWindow(_In_ HWND)
#define DM_GETDEFID
Definition: winuser.h:2080
#define DS_MODALFRAME
Definition: winuser.h:375
static void FormEnterMsg(MSG *pMsg, HWND hwnd)
Definition: dialog.c:232
#define WS_EX_CONTROLPARENT
Definition: winuser.h:387
static BOOL g_bReceivedCommand
Definition: dialog.c:57
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4216
smooth NULL
Definition: ftsmooth.c:416
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
LRESULT WINAPI DefDlgProcA(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1662
static HWND g_hwndTestDlgEdit
Definition: dialog.c:53
#define WS_EX_LEFT
Definition: winuser.h:391
#define WS_MAXIMIZEBOX
Definition: pedump.c:632
#define DLGC_DEFPUSHBUTTON
Definition: winuser.h:2590
#define WS_OVERLAPPED
Definition: pedump.c:615
#define BM_SETSTYLE
Definition: winuser.h:1906
unsigned long DWORD
Definition: ntddk_ex.h:95
#define DS_SETFONT
Definition: winuser.h:378
#define WS_EX_RIGHTSCROLLBAR
Definition: winuser.h:401
#define GWL_STYLE
Definition: winuser.h:846
#define DS_3DLOOK
Definition: winuser.h:367
#define WS_MINIMIZEBOX
Definition: pedump.c:631
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define ok(value,...)
Definition: atltest.h:57
HWND WINAPI GetFocus(void)
Definition: window.c:1905
#define msg(x)
Definition: auth_time.c:54
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define IDCANCEL
Definition: winuser.h:825
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define LOWORD(l)
Definition: pedump.c:82
static HINSTANCE g_hinst
Definition: dialog.c:51

Referenced by START_TEST().

◆ TestControlStyleDlgProc()

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

Definition at line 1228 of file dialog.c.

1230 {
1231  HWND control;
1232  DWORD style, exstyle;
1233  char buf[256];
1234 
1235  switch (msg)
1236  {
1237  case WM_INITDIALOG:
1238  control = GetDlgItem(hdlg, 7);
1239  ok(control != 0, "dialog control with id 7 not found\n");
1240  style = GetWindowLongA(control, GWL_STYLE);
1241  ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#x\n", style);
1242  exstyle = GetWindowLongA(control, GWL_EXSTYLE);
1243  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);
1244  buf[0] = 0;
1245  GetWindowTextA(control, buf, sizeof(buf));
1246  ok(strcmp(buf, "bump7") == 0, "expected bump7, got %s\n", buf);
1247 
1248  control = GetDlgItem(hdlg, 8);
1249  ok(control != 0, "dialog control with id 8 not found\n");
1250  style = GetWindowLongA(control, GWL_STYLE);
1251  ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#x\n", style);
1252  exstyle = GetWindowLongA(control, GWL_EXSTYLE);
1253  ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT, got %#x\n", exstyle);
1254  buf[0] = 0;
1255  GetWindowTextA(control, buf, sizeof(buf));
1256  ok(strcmp(buf, "bump8") == 0, "expected bump8, got %s\n", buf);
1257 
1258  EndDialog(hdlg, -7);
1259  return TRUE;
1260  }
1261  return FALSE;
1262 }
#define TRUE
Definition: types.h:120
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
#define GWL_EXSTYLE
Definition: winuser.h:845
#define WS_CHILD
Definition: pedump.c:617
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GWL_STYLE
Definition: winuser.h:846
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2126
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define WM_INITDIALOG
Definition: winuser.h:1721

Referenced by test_DialogBoxParam().

◆ TestDefButtonDlgProc()

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

Definition at line 1176 of file dialog.c.

1178 {
1179  switch (uiMsg)
1180  {
1181  case WM_INITDIALOG:
1182  EndDialog(hDlg, LOWORD(SendMessageA(hDlg, DM_GETDEFID, 0, 0)));
1183  return TRUE;
1184  }
1185  return FALSE;
1186 }
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DM_GETDEFID
Definition: winuser.h:2080
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82

Referenced by test_DialogBoxParam().

◆ testDlgWinProc()

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

Definition at line 523 of file dialog.c.

525 {
526  switch (uiMsg)
527  {
528  /* Add blank case statements for these to ensure we don't use them
529  * by mistake.
530  */
531  case DM_GETDEFID: break;
532  case DM_SETDEFID: break;
533 
534  case WM_CREATE:
535  return (OnTestDlgCreate (hwnd,
536  (LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1);
537  case WM_COMMAND:
538  if(LOWORD(wParam) == 300) g_bReceivedCommand = TRUE;
539  }
540 
541  return DefDlgProcA (hwnd, uiMsg, wParam, lParam);
542 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define DM_SETDEFID
Definition: winuser.h:2081
WPARAM wParam
Definition: combotst.c:138
#define DM_GETDEFID
Definition: winuser.h:2080
static BOOL g_bReceivedCommand
Definition: dialog.c:57
LRESULT WINAPI DefDlgProcA(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1662
#define WM_COMMAND
Definition: winuser.h:1722
static BOOL OnTestDlgCreate(HWND hwnd, LPCREATESTRUCTA lpcs)
Definition: dialog.c:433
#define WM_CREATE
Definition: winuser.h:1590
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by RegisterWindowClasses().

◆ TestInitDialogHandleProc()

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

Definition at line 1160 of file dialog.c.

1162 {
1163  if (uiMsg == WM_INITDIALOG)
1164  {
1166  ok(expected == (HWND)wParam,
1167  "Expected wParam to be the handle to the first tabstop control (%p), got %p\n",
1168  expected, (HWND)wParam);
1169 
1170  EndDialog(hDlg, LOWORD(SendMessageA(hDlg, DM_GETDEFID, 0, 0)));
1171  return TRUE;
1172  }
1173  return FALSE;
1174 }
HWND WINAPI GetNextDlgTabItem(HWND hDlg, HWND hCtl, BOOL bPrevious)
Definition: dialog.c:2343
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
WPARAM wParam
Definition: combotst.c:138
#define DM_GETDEFID
Definition: winuser.h:2080
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
#define ok(value,...)
Definition: atltest.h:57
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
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 1188 of file dialog.c.

1190 {
1191  static int received_idok;
1192 
1193  switch (uiMsg)
1194  {
1195  case WM_INITDIALOG:
1196  {
1197  MSG msg = {hDlg, WM_KEYDOWN, VK_RETURN, 0x011c0001};
1198 
1199  received_idok = -1;
1200  IsDialogMessageA(hDlg, &msg);
1201  ok(received_idok == 0xdead, "WM_COMMAND/0xdead not received\n");
1202 
1203  received_idok = -2;
1204  IsDialogMessageA(hDlg, &msg);
1205  ok(received_idok == IDOK, "WM_COMMAND/IDOK not received\n");
1206 
1207  EndDialog(hDlg, 0);
1208  return TRUE;
1209  }
1210 
1211  case DM_GETDEFID:
1212  if (received_idok == -1)
1213  {
1214  HWND hwnd = GetDlgItem(hDlg, 0xdead);
1215  ok(!hwnd, "dialog item with ID 0xdead should not exist\n");
1217  return TRUE;
1218  }
1219  return FALSE;
1220 
1221  case WM_COMMAND:
1222  received_idok = wParam;
1223  return TRUE;
1224  }
1225  return FALSE;
1226 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define MAKELRESULT(l, h)
Definition: winuser.h:3949
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
BOOL WINAPI IsDialogMessageA(_In_ HWND, _In_ LPMSG)
#define VK_RETURN
Definition: winuser.h:2176
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define DM_GETDEFID
Definition: winuser.h:2080
#define DC_HASDEFID
Definition: winuser.h:2584
#define WM_KEYDOWN
Definition: winuser.h:1697
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
#define ok(value,...)
Definition: atltest.h:57
LONG WINAPI SetWindowLongA(_In_ HWND, _In_ int, _In_ LONG)
#define msg(x)
Definition: auth_time.c:54
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2126
#define WM_INITDIALOG
Definition: winuser.h:1721

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

1954 {
1955  static int count;
1956  BOOL visible;
1957 
1958  switch (msg)
1959  {
1960  case WM_INITDIALOG:
1961  visible = GetWindowLongA(wnd, GWL_STYLE) & WS_VISIBLE;
1962  ok(!visible, "Dialog should not be visible.\n");
1963  SetTimer(wnd, 1, 100, NULL);
1964  Sleep(200);
1965  return FALSE;
1966 
1967  case WM_COMMAND:
1968  if (LOWORD(wparam) != IDCANCEL) return FALSE;
1969  EndDialog(wnd, LOWORD(wparam));
1970  return TRUE;
1971 
1972  case WM_TIMER:
1973  if (wparam != 1) return FALSE;
1974  visible = GetWindowLongA(wnd, GWL_STYLE) & WS_VISIBLE;
1975  if (!count++)
1976  {
1977  ok(!visible, "Dialog should not be visible.\n");
1978  PostMessageA(wnd, WM_USER, 0, 0);
1979  }
1980  else
1981  {
1982  ok(visible, "Dialog should be visible.\n");
1983  PostMessageA(wnd, WM_COMMAND, IDCANCEL, 0);
1984  }
1985  return TRUE;
1986 
1987  case WM_USER:
1988  visible = GetWindowLongA(wnd, GWL_STYLE) & WS_VISIBLE;
1989  ok(visible, "Dialog should be visible.\n");
1990  return TRUE;
1991 
1992  default:
1993  return FALSE;
1994  }
1995 }
#define TRUE
Definition: types.h:120
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
GLuint GLuint GLsizei count
Definition: gl.h:1545
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_TIMER
Definition: winuser.h:1724
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_USER
Definition: winuser.h:1877
#define GWL_STYLE
Definition: winuser.h:846
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2028
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define IDCANCEL
Definition: winuser.h:825
#define WS_VISIBLE
Definition: pedump.c:620
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by test_timer_message().

◆ wait_for_window()

static HWND wait_for_window ( const char caption)
static

Definition at line 2055 of file dialog.c.

2056 {
2057  HWND hwnd;
2058  DWORD timeout = 0;
2059 
2060  for (;;)
2061  {
2063  if (hwnd) break;
2064 
2065  Sleep(50);
2066  timeout += 50;
2067  if (timeout > 3000)
2068  {
2069  ok(0, "failed to wait for a window %s\n", caption);
2070  break;
2071  }
2072  }
2073 
2074  Sleep(50);
2075  return hwnd;
2076 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
char caption[64]
Definition: dialog.c:2033
Definition: dhcpd.h:245
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND WINAPI FindWindowA(_In_opt_ LPCSTR, _In_opt_ LPCSTR)
static HWND hwnd[MAXHWNDS]
Definition: dialog.c:47
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_MessageBox().

Variable Documentation

◆ g_bInitialFocusInitDlgResult

BOOL g_bInitialFocusInitDlgResult
static

Definition at line 57 of file dialog.c.

Referenced by delayFocusDlgWinProc(), and test_focus().

◆ g_bReceivedCommand

BOOL g_bReceivedCommand
static

Definition at line 57 of file dialog.c.

Referenced by test_WM_NEXTDLGCTL(), and testDlgWinProc().

◆ g_hinst

◆ g_hwndButton1

HWND g_hwndButton1
static

◆ g_hwndButton2

HWND g_hwndButton2
static

Definition at line 52 of file dialog.c.

Referenced by delayFocusDlgWinProc(), GetHwndString(), OnMainWindowCreate(), and test_focus().

◆ g_hwndButtonCancel

HWND g_hwndButtonCancel
static

◆ g_hwndInitialFocusGroupBox

HWND g_hwndInitialFocusGroupBox
static

Definition at line 54 of file dialog.c.

Referenced by delayFocusDlgWinProc(), and GetHwndString().

◆ g_hwndInitialFocusT1

HWND g_hwndInitialFocusT1
static

Definition at line 54 of file dialog.c.

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

◆ g_hwndInitialFocusT2

HWND g_hwndInitialFocusT2
static

Definition at line 54 of file dialog.c.

Referenced by delayFocusDlgWinProc(), and test_focus().

◆ g_hwndMain

HWND g_hwndMain
static

Definition at line 52 of file dialog.c.

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

◆ g_hwndTestDlg

HWND g_hwndTestDlg
static

Definition at line 53 of file dialog.c.

Referenced by test_WM_NEXTDLGCTL().

◆ g_hwndTestDlgBut1

HWND g_hwndTestDlgBut1
static

Definition at line 53 of file dialog.c.

Referenced by OnTestDlgCreate(), and test_WM_NEXTDLGCTL().

◆ g_hwndTestDlgBut2

HWND g_hwndTestDlgBut2
static

Definition at line 53 of file dialog.c.

Referenced by OnTestDlgCreate(), and test_WM_NEXTDLGCTL().

◆ g_hwndTestDlgEdit

HWND g_hwndTestDlgEdit
static

Definition at line 53 of file dialog.c.

Referenced by OnTestDlgCreate(), and test_WM_NEXTDLGCTL().

◆ g_MSGF_DIALOGBOX

BOOL g_MSGF_DIALOGBOX
static

Definition at line 744 of file dialog.c.

Referenced by hook_proc2(), and test_IsDialogMessage().

◆ g_styleInitialFocusT1

LONG g_styleInitialFocusT1
static

Definition at line 56 of file dialog.c.

Referenced by delayFocusDlgWinProc(), and test_focus().

◆ g_styleInitialFocusT2

LONG g_styleInitialFocusT2
static

Definition at line 56 of file dialog.c.

Referenced by delayFocusDlgWinProc(), and test_focus().

◆ g_terminated

BOOL g_terminated
static

◆ hierarchy

◆ hwnd

◆ numwnds

unsigned int numwnds =1
static

Definition at line 48 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 1277 of file dialog.c.

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

◆ testtext

◆ testtextW

const WCHAR testtextW[] = {'W','n','d','T','e','x','t',0}
static

Definition at line