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

Go to the source code of this file.

Classes

struct  h_entry
 
struct  test_record
 
struct  create_window_params
 

Macros

#define MAXHWNDS   1024
 

Enumerations

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

Functions

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

Variables

static HWND hwnd [MAXHWNDS]
 
static unsigned int numwnds =1
 
static HINSTANCE g_hinst
 
static HWND g_hwndMain
 
static HWND g_hwndButton1
 
static HWND g_hwndButton2
 
static HWND g_hwndButtonCancel
 
static HWND g_hwndTestDlg
 
static HWND g_hwndTestDlgBut1
 
static HWND g_hwndTestDlgBut2
 
static HWND g_hwndTestDlgEdit
 
static HWND g_hwndInitialFocusT1
 
static HWND g_hwndInitialFocusT2
 
static HWND g_hwndInitialFocusGroupBox
 
static LONG g_styleInitialFocusT1
 
static LONG g_styleInitialFocusT2
 
static BOOL g_bInitialFocusInitDlgResult
 
static BOOL g_bReceivedCommand
 
static BOOL g_terminated
 
static BOOL g_button1Clicked
 
static const h_entry hierarchy []
 
static BOOL g_MSGF_DIALOGBOX
 
static const WCHAR testtextW [] = {'W','n','d','T','e','x','t',0}
 
static const chartesttext = "WndText"
 
static const chartestmodes []
 
static const char msgbox_title [] = "%5!z9ZXw*ia;57n/FGl.bCH,Su\"mfKN;foCqAU\'j6AmoJgAc_D:Z0A\'E6PF_O/w"
 
static WCHAR expectedOK []
 
static WCHAR expectedOkCancel []
 
static WCHAR expectedAbortRetryIgnore []
 
static WCHAR expectedYesNo []
 
static WCHAR expectedYesNoCancel []
 
static WCHAR expectedRetryCancel []
 
static WCHAR expectedCancelTryContinue []
 
BOOL non_english = FALSE
 

Macro Definition Documentation

◆ MAXHWNDS

#define MAXHWNDS   1024

Definition at line 43 of file dialog.c.

Enumeration Type Documentation

◆ defdlgproc_text

Enumerator
DLGPROCTEXT_SNDMSGA 
DLGPROCTEXT_SNDMSGW 
DLGPROCTEXT_DLGPROCA 
DLGPROCTEXT_DLGPROCW 
DLGPROCTEXT_SETTEXTA 
DLGPROCTEXT_SETTEXTW 

Definition at line 1387 of file dialog.c.

Function Documentation

◆ create_window_thread()

static DWORD WINAPI create_window_thread ( void param)
static

Definition at line 2338 of file dialog.c.

2339 {
2340  struct create_window_params *p = param;
2341  HWND owner = 0;
2342 
2343  if (p->owner)
2344  {
2345  owner = CreateWindowExA(0, "Static", NULL, WS_POPUP, 10, 10, 10, 10, 0, 0, 0, NULL);
2346  ok(owner != 0, "failed to create owner window\n");
2347  }
2348 
2349  MessageBoxA(owner, NULL, p->caption, p->style);
2350 
2351  if (owner) DestroyWindow(owner);
2352 
2353  return 0;
2354 }
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 155 of file dialog.c.

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

2451 {
2452  if (msg == WM_INITDIALOG)
2453  EndDialog(hdlg, 0);
2454 
2455  return FALSE;
2456 }
#define FALSE
Definition: types.h:117
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2091
#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 824 of file dialog.c.

826 {
827  switch (uiMsg)
828  {
829  case WM_INITDIALOG:
830  g_hwndMain = hDlg;
832  g_hwndButton1 = GetDlgItem(hDlg,200);
833  g_hwndButton2 = GetDlgItem(hDlg,201);
836 
837  /* Initially check the second radio button */
840  /* Continue testing after dialog initialization */
841  PostMessageA(hDlg, WM_USER, 0, 0);
843 
844  case WM_COMMAND:
845  if (LOWORD(wParam) == IDCANCEL)
846  {
847  EndDialog(hDlg, LOWORD(wParam));
848  return TRUE;
849  }
850  return FALSE;
851 
852  case WM_USER:
855  SetFocus(hDlg);
857  PostMessageA(hDlg, WM_COMMAND, IDCANCEL, 0);
858  return TRUE;
859  }
860 
861  return FALSE;
862 }
static HWND g_hwndButtonCancel
Definition: dialog.c:49
#define TRUE
Definition: types.h:120
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND g_hwndInitialFocusT2
Definition: dialog.c:51
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:53
#define FALSE
Definition: types.h:117
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define BM_SETCHECK
Definition: winuser.h:1903
static HWND g_hwndInitialFocusGroupBox
Definition: dialog.c:51
#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:2091
static HWND g_hwndMain
Definition: dialog.c:49
#define BST_CHECKED
Definition: winuser.h:197
HWND WINAPI GetFocus(void)
Definition: window.c:1909
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2189
#define IDCANCEL
Definition: winuser.h:825
static HWND g_hwndButton1
Definition: dialog.c:49
static BOOL g_bInitialFocusInitDlgResult
Definition: dialog.c:54
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
static HWND g_hwndButton2
Definition: dialog.c:49
static LONG g_styleInitialFocusT2
Definition: dialog.c:53
static HWND g_hwndInitialFocusT1
Definition: dialog.c:51

Referenced by test_focus().

◆ DestroyDlgWinProc()

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

Definition at line 1251 of file dialog.c.

1253 {
1254  if (uiMsg == WM_INITDIALOG)
1255  {
1256  DestroyWindow(hDlg);
1257  return TRUE;
1258  }
1259  return FALSE;
1260 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DestroyWindow(_In_ HWND)
#define FALSE
Definition: types.h:117
#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 1262 of file dialog.c.

1264 {
1265  switch (uiMsg)
1266  {
1267  case WM_INITDIALOG:
1268  PostMessageA(hDlg, WM_CLOSE, 0, 0);
1269  return TRUE;
1270  case WM_CLOSE:
1271  DestroyWindow(hDlg);
1272  return TRUE;
1273  case WM_DESTROY:
1274  PostQuitMessage(0);
1275  return TRUE;
1276  }
1277  return FALSE;
1278 }
#define TRUE
Definition: types.h:120
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define FALSE
Definition: types.h:117
#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 492 of file dialog.c.

494 {
495  switch (uiMsg)
496  {
497  case WM_INITDIALOG:
498  {
499  DWORD dw;
500  HWND hwndOk;
501 
502  dw = SendMessageA(hwnd, DM_GETDEFID, 0, 0);
504  hwndOk = GetDlgItem(hwnd, LOWORD(dw));
505  assert(hwndOk);
506  EnableWindow(hwndOk, FALSE);
507 
510  break;
511  }
512  case WM_COMMAND:
513  if (wParam == IDOK)
514  {
515  g_terminated = TRUE;
516  EndDialog(hwnd, 0);
517  return 0;
518  }
519  else if (wParam == IDCANCEL)
520  {
521  EndDialog(hwnd, 0);
522  return 0;
523  }
524  break;
525  }
526 
527  return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
528 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
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 FALSE
Definition: types.h:117
#define DC_HASDEFID
Definition: winuser.h:2584
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
#define WM_KEYDOWN
Definition: winuser.h:1697
unsigned long DWORD
Definition: ntddk_ex.h:95
#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:2091
static BOOL g_terminated
Definition: dialog.c:56
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2189
#define HIWORD(l)
Definition: typedefs.h:247
#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 1505 of file dialog.c.

1506 {
1507  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SNDMSGA));
1508  SendMessageA(hdlg, msg, 0, (LPARAM)testtext);
1509 
1510  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SNDMSGW));
1511  SendMessageW(hdlg, msg, 0, (LPARAM)testtextW);
1512 
1513  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_DLGPROCA));
1514  DefDlgProcA(hdlg, msg, 0, (LPARAM)testtext);
1515 
1516  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_DLGPROCW));
1517  DefDlgProcW(hdlg, msg, 0, (LPARAM)testtextW);
1518 }
#define ULongToHandle(h)
Definition: basetsd.h:81
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:1782
LONG_PTR LPARAM
Definition: windef.h:208
LRESULT WINAPI DefDlgProcA(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1719
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
static const WCHAR testtextW[]
Definition: dialog.c:1384
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:1385

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

◆ EmptyProcUserTemplate()

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

Definition at line 885 of file dialog.c.

886 {
887  switch(uMsg) {
888  case WM_INITDIALOG:
889  return TRUE;
890  }
891  return FALSE;
892 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define WM_INITDIALOG
Definition: winuser.h:1721

Referenced by focusChildDlgWinProc().

◆ focusChildDlgWinProc()

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

Definition at line 894 of file dialog.c.

896 {
897  static HWND hChildDlg;
898 
899  switch (uiMsg)
900  {
901  case WM_INITDIALOG:
902  {
903  RECT rectHwnd;
904  struct {
905  DLGTEMPLATE tmplate;
906  WORD menu,class,title;
907  } temp;
908 
909  SetFocus( GetDlgItem(hwnd, 200) );
910 
911  GetClientRect(hwnd,&rectHwnd);
913  temp.tmplate.dwExtendedStyle = 0;
914  temp.tmplate.cdit = 0;
915  temp.tmplate.x = 0;
916  temp.tmplate.y = 0;
917  temp.tmplate.cx = 0;
918  temp.tmplate.cy = 0;
919  temp.menu = temp.class = temp.title = 0;
920 
921  hChildDlg = CreateDialogIndirectParamA(g_hinst, &temp.tmplate,
923  ok(hChildDlg != 0, "Failed to create test dialog.\n");
924 
925  return FALSE;
926  }
927  case WM_CLOSE:
928  DestroyWindow(hChildDlg);
929  return TRUE;
930  }
931 
932  return FALSE;
933 }
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND WINAPI CreateDialogIndirectParamA(HINSTANCE hInstance, LPCDLGTEMPLATE lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit)
Definition: dialog.c:1645
#define WS_CHILD
Definition: pedump.c:617
static INT_PTR CALLBACK EmptyProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:885
BOOL WINAPI DestroyWindow(_In_ HWND)
#define FALSE
Definition: types.h:117
#define WM_CLOSE
Definition: winuser.h:1603
unsigned short WORD
Definition: ntddk_ex.h:93
INT_PTR(CALLBACK * DLGPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2871
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DS_3DLOOK
Definition: winuser.h:367
static calc_node_t temp
Definition: rpn_ieee.c:38
#define DS_CONTROL
Definition: winuser.h:372
#define ok(value,...)
Definition: atltest.h:57
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2189
#define WS_VISIBLE
Definition: pedump.c:620
#define WM_INITDIALOG
Definition: winuser.h:1721
static char title[]
Definition: ps.c:92
static HINSTANCE g_hinst
Definition: dialog.c:48

Referenced by test_focus().

◆ focusDlgWinProc()

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

Definition at line 864 of file dialog.c.

866 {
867  switch (uiMsg)
868  {
869  case WM_INITDIALOG:
870  SetWindowTextA(GetDlgItem(hDlg, 200), "new caption");
871  return TRUE;
872 
873  case WM_COMMAND:
874  if (LOWORD(wParam) == 200)
875  {
876  if (HIWORD(wParam) == EN_SETFOCUS)
878  }
879  return FALSE;
880  }
881 
882  return FALSE;
883 }
#define TRUE
Definition: types.h:120
HANDLE HWND
Definition: compat.h:19
WPARAM wParam
Definition: combotst.c:138
#define EN_SETFOCUS
Definition: winuser.h:2009
#define FALSE
Definition: types.h:117
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:2189
#define HIWORD(l)
Definition: typedefs.h:247
#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:51

Referenced by test_focus().

◆ FormEnterMsg()

static void FormEnterMsg ( MSG pMsg,
HWND  hwnd 
)
static

Definition at line 235 of file dialog.c.

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

Referenced by test_IsDialogMessage(), and test_WM_NEXTDLGCTL().

◆ FormTabMsg()

static void FormTabMsg ( MSG pMsg,
HWND  hwnd 
)
static

Definition at line 224 of file dialog.c.

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

Referenced by test_IsDialogMessage().

◆ get_button_style()

static DWORD get_button_style ( HWND  button)
static

Definition at line 150 of file dialog.c.

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

Referenced by test_WM_NEXTDLGCTL().

◆ getdlgitem_test_dialog_proc()

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

Definition at line 1159 of file dialog.c.

1160 {
1161  if (msg == WM_INITDIALOG)
1162  {
1163  char text[64];
1164  LONG_PTR val;
1165  HWND hwnd;
1166  BOOL ret;
1167 
1168  hwnd = GetDlgItem(hdlg, -1);
1169  ok(hwnd != NULL, "Expected dialog item.\n");
1170 
1171  *text = 0;
1172  ret = GetDlgItemTextA(hdlg, -1, text, ARRAY_SIZE(text));
1173  ok(ret && !strcmp(text, "Text1"), "Unexpected item text.\n");
1174 
1176  ok(val == -1, "Unexpected id.\n");
1177 
1179  ok(val == -1, "Unexpected id %ld.\n", val);
1180 
1181  hwnd = GetDlgItem(hdlg, -2);
1182  ok(hwnd != NULL, "Expected dialog item.\n");
1183 
1185  ok(val == -2, "Unexpected id.\n");
1186 
1188  ok(val == -2, "Unexpected id %ld.\n", val);
1189 
1190  EndDialog(hdlg, 0xdead);
1191  }
1192 
1193  return FALSE;
1194 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
const WCHAR * text
Definition: package.c:1827
#define FALSE
Definition: types.h:117
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
GLuint GLfloat * val
Definition: glext.h:7180
#define GetWindowLongPtrA
Definition: winuser.h:4803
int ret
UINT WINAPI GetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPSTR lpString, int nMaxCount)
Definition: dialog.c:2253
static HWND hwnd[MAXHWNDS]
Definition: dialog.c:44
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2091
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define msg(x)
Definition: auth_time.c:54
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2189
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define WM_INITDIALOG
Definition: winuser.h:1721
#define GWLP_ID
Definition: winuser.h:854

Referenced by test_GetDlgItem().

◆ GetHwndString()

static const char* GetHwndString ( HWND  hw)
static

Definition at line 936 of file dialog.c.

937 {
938  if (hw == NULL)
939  return "a null handle";
940  if (hw == g_hwndMain)
941  return "the dialog handle";
942  if (hw == g_hwndInitialFocusGroupBox)
943  return "the group box control";
944  if (hw == g_hwndButton1)
945  return "the first button";
946  if (hw == g_hwndButton2)
947  return "the second button";
948  if (hw == g_hwndButtonCancel)
949  return "the cancel button";
950 
951  return "unknown handle";
952 }
static HWND g_hwndButtonCancel
Definition: dialog.c:49
smooth NULL
Definition: ftsmooth.c:416
static HWND g_hwndInitialFocusGroupBox
Definition: dialog.c:51
static HWND g_hwndMain
Definition: dialog.c:49
static HWND g_hwndButton1
Definition: dialog.c:49
static HWND g_hwndButton2
Definition: dialog.c:49

Referenced by test_focus().

◆ hook_proc()

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

Definition at line 716 of file dialog.c.

717 {
718  ok(0, "unexpected hook called, code %d\n", code);
719  return CallNextHookEx(NULL, code, wParam, lParam);
720 }
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
Definition: inflate.c:139
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 723 of file dialog.c.

724 {
725  ok(code == MSGF_DIALOGBOX, "unexpected hook called, code %d\n", code);
727  return CallNextHookEx(NULL, code, wParam, lParam);
728 }
#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:722
Definition: inflate.c:139
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 261 of file dialog.c.

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

Referenced by DIALOG_GetControl32().

◆ KeyDownData()

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

Definition at line 217 of file dialog.c.

218 {
219  return ((repeat & 0x0000FFFF) | ((scancode & 0x00FF) << 16) |
220  (extended ? 0x01000000 : 0) | (wasdown ? 0x40000000 : 0));
221 }
static int repeat
Definition: xmllint.c: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 462 of file dialog.c.

464 {
465  switch (uiMsg)
466  {
467  /* Add blank case statements for these to ensure we don't use them
468  * by mistake.
469  */
470  case DM_GETDEFID: break;
471  case DM_SETDEFID: break;
472 
473  case WM_CREATE:
474  return (OnMainWindowCreate (hwnd,
475  (LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1);
476  case WM_COMMAND:
477  if (wParam == IDCANCEL)
478  {
479  g_terminated = TRUE;
480  return 0;
481  }
482  else if ((wParam == 100 || wParam == 0xFFFF) && lParam)
483  {
485  }
486  break;
487  }
488 
489  return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
490 }
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_button1Clicked
Definition: dialog.c:57
static BOOL OnMainWindowCreate(HWND hwnd, LPCREATESTRUCTA lpcs)
Definition: dialog.c:411
#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:56
#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 1894 of file dialog.c.

1896 {
1897  if (uiMsg == WM_INITDIALOG) {
1898  SetFocus(hDlg);
1899  return 1;
1900  }
1901 
1902  return 0;
1903 }
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 2303 of file dialog.c.

2304 {
2305  if (code == HCBT_ACTIVATE)
2306  {
2307  HWND msgbox = (HWND)wParam, msghwnd;
2308  char text[64];
2309 
2310  if (msgbox)
2311  {
2312  text[0] = 0;
2313  GetWindowTextA(msgbox, text, sizeof(text));
2314  ok(!strcmp(text, "MSGBOX caption"), "Unexpected window text \"%s\"\n", text);
2315 
2316  msghwnd = GetDlgItem(msgbox, 0xffff);
2317  ok(msghwnd != NULL, "Expected static control\n");
2318 
2319  text[0] = 0;
2320  GetWindowTextA(msghwnd, text, sizeof(text));
2321  ok(!strcmp(text, "Text"), "Unexpected window text \"%s\"\n", text);
2322 
2324  SendDlgItemMessageA(msgbox, IDCANCEL, WM_LBUTTONUP, 0, 0);
2325  }
2326  }
2327 
2328  return CallNextHookEx(NULL, code, wParam, lParam);
2329 }
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1330
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
const WCHAR * text
Definition: package.c:1827
HANDLE HWND
Definition: compat.h:19
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:2756
Definition: inflate.c:139
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:2189
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 411 of file dialog.c.

412 {
413  g_hwndButton1 = CreateWindowA("button", "Button &1",
415  10, 10, 80, 80, hwnd, (HMENU)100, g_hinst, 0);
416  if (!g_hwndButton1) return FALSE;
417 
418  g_hwndButton2 = CreateWindowA("button", "Button &2",
420  110, 10, 80, 80, hwnd, (HMENU)200, g_hinst, 0);
421  if (!g_hwndButton2) return FALSE;
422 
423  g_hwndButtonCancel = CreateWindowA("button", "Cancel",
425  210, 10, 80, 80, hwnd, (HMENU)IDCANCEL, g_hinst, 0);
426  if (!g_hwndButtonCancel) return FALSE;
427 
428  return TRUE;
429 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HWND g_hwndButtonCancel
Definition: dialog.c:49
#define TRUE
Definition: types.h:120
#define BS_TEXT
Definition: winuser.h:276
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
#define WS_CHILD
Definition: pedump.c:617
#define FALSE
Definition: types.h:117
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
#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:49
static HINSTANCE g_hinst
Definition: dialog.c:48
static HWND g_hwndButton2
Definition: dialog.c:49

Referenced by main_window_procA().

◆ OnTestDlgCreate()

static BOOL OnTestDlgCreate ( HWND  hwnd,
LPCREATESTRUCTA  lpcs 
)
static

Definition at line 436 of file dialog.c.

437 {
440  "Edit", "Edit",
442  16,33,184,24, hwnd, (HMENU)101, g_hinst, 0);
443  if (!g_hwndTestDlgEdit) return FALSE;
444 
447  "button", "Button &1",
449  204,33,30,24, hwnd, (HMENU)201, g_hinst, 0);
450  if (!g_hwndTestDlgBut1) return FALSE;
451 
453  | WS_EX_NOPARENTNOTIFY, "button",
454  "Button &2",
456  90,102,80,24, hwnd, (HMENU)IDCANCEL, g_hinst, 0);
457  if (!g_hwndTestDlgBut2) return FALSE;
458 
459  return TRUE;
460 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HWND g_hwndTestDlgBut1
Definition: dialog.c:50
static HWND g_hwndTestDlgBut2
Definition: dialog.c:50
#define WS_EX_LTRREADING
Definition: winuser.h:393
#define TRUE
Definition: types.h:120
#define BS_TEXT
Definition: winuser.h:276
#define FALSE
Definition: types.h:117
static HWND g_hwndTestDlgEdit
Definition: dialog.c:50
#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:48

Referenced by testDlgWinProc().

◆ RegisterWindowClasses()

static BOOL RegisterWindowClasses ( void  )
static

Definition at line 571 of file dialog.c.

572 {
573  WNDCLASSA cls;
574 
575  cls.style = 0;
577  cls.cbClsExtra = 0;
578  cls.cbWndExtra = 0;
579  cls.hInstance = g_hinst;
580  cls.hIcon = NULL;
582  cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
583  cls.lpszMenuName = NULL;
584  cls.lpszClassName = "GetNextDlgItemWindowClass";
585 
586  if (!RegisterClassA (&cls)) return FALSE;
587 
589  cls.lpszClassName = "IsDialogMessageWindowClass";
590  if (!RegisterClassA (&cls)) return FALSE;
591 
593  cls.lpszClassName = "TESTCONTROL";
594  if (!RegisterClassA (&cls)) return FALSE;
595 
596  GetClassInfoA(0, "#32770", &cls);
598  cls.lpszClassName = "WM_NEXTDLGCTLWndClass";
599  if (!RegisterClassA (&cls)) return FALSE;
600 
601  return TRUE;
602 }
#define TRUE
Definition: types.h:120
int cbClsExtra
Definition: winuser.h:3140
LPCSTR lpszMenuName
Definition: winuser.h:3146
HBRUSH hbrBackground
Definition: winuser.h:3145
#define COLOR_WINDOW
Definition: winuser.h:908
int cbWndExtra
Definition: winuser.h:3141
#define FALSE
Definition: types.h:117
BOOL WINAPI GetClassInfoA(_In_opt_ HINSTANCE, _In_ LPCSTR, _Out_ LPWNDCLASSA)
HCURSOR hCursor
Definition: winuser.h:3144
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:551
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LPCSTR lpszClassName
Definition: winuser.h:3147
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
UINT style
Definition: winuser.h:3138
static LRESULT CALLBACK main_window_procA(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:462
HINSTANCE hInstance
Definition: winuser.h:3142
static LRESULT CALLBACK testDlgWinProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:530
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define IDC_ARROW
Definition: winuser.h:682
static HINSTANCE g_hinst
Definition: dialog.c:48
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3143

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dialog  )

Definition at line 2463 of file dialog.c.

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

◆ test_aw_conversion_dlgproc()

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

Definition at line 1520 of file dialog.c.

1521 {
1522  ULONG_PTR dlgproc, originalproc;
1523  WCHAR buffW[64];
1524  char buff[64];
1525  BOOL ret;
1526  INT len;
1527 
1528  switch (msg)
1529  {
1530  case WM_INITDIALOG:
1531  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1532 
1535  dlg_test_aw_message(hdlg, CB_DIR);
1536  dlg_test_aw_message(hdlg, LB_DIR);
1540 
1541  /* WM_SETTEXT/WM_GETTEXT */
1542  originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1543  ok(originalproc == (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", originalproc);
1544 
1545  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1546  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", dlgproc);
1547 
1549  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1550 
1551  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1552  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1553 
1554  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1555  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1556 
1557  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1558  ret = SetWindowTextA(hdlg, testtext);
1559  todo_wine
1560  ok(ret, "Failed to set window text.\n");
1561 
1562  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1563  ret = SetWindowTextW(hdlg, testtextW);
1564  todo_wine
1565  ok(ret, "Failed to set window text.\n");
1566 
1567  memset(buff, 'A', sizeof(buff));
1568  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1569  ok(buff[0] == 0 && buff[1] == 'A' && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1570  (BYTE)buff[0], (BYTE)buff[1], len);
1571 
1572  memset(buffW, 0xff, sizeof(buffW));
1573  len = GetWindowTextW(hdlg, buffW, 64);
1574  ok(!lstrcmpW(buffW, testtextW) && len == 0, "Unexpected window text %s, len %d\n", wine_dbgstr_w(buffW), len);
1575 
1578  dlg_test_aw_message(hdlg, CB_DIR);
1579  dlg_test_aw_message(hdlg, LB_DIR);
1583 
1585  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1586 
1587  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1588  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1589 
1590  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1591  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1592 
1593  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1594  ret = SetWindowTextA(hdlg, testtext);
1595  todo_wine
1596  ok(ret, "Failed to set window text.\n");
1597 
1598  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1599  ret = SetWindowTextW(hdlg, testtextW);
1600  todo_wine
1601  ok(ret, "Failed to set window text.\n");
1602 
1603  memset(buff, 'A', sizeof(buff));
1604  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1605  ok(buff[0] == 0 && buff[1] == 'A' && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1606  (BYTE)buff[0], (BYTE)buff[1], len);
1607 
1608  memset(buffW, 0xff, sizeof(buffW));
1609  len = GetWindowTextW(hdlg, buffW, ARRAY_SIZE(buffW));
1610  ok(buffW[0] == 'W' && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1611  buffW[0], buffW[1], len);
1612 
1615  dlg_test_aw_message(hdlg, CB_DIR);
1616  dlg_test_aw_message(hdlg, LB_DIR);
1620 
1621  SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
1622  EndDialog(hdlg, -123);
1623  return TRUE;
1624  }
1625  return FALSE;
1626 }
#define ULongToHandle(h)
Definition: basetsd.h:81
#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:1330
#define TRUE
Definition: types.h:120
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:4804
int32_t INT
Definition: typedefs.h:58
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1505
uint32_t ULONG_PTR
Definition: typedefs.h:65
static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1457
#define FALSE
Definition: types.h:117
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:4803
__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:162
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
GLenum GLsizei len
Definition: glext.h:6722
#define SetWindowLongPtrA
Definition: winuser.h:5320
static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1407
unsigned char BYTE
Definition: xxhash.c:193
static const WCHAR testtextW[]
Definition: dialog.c:1384
static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1520
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2091
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
#define CB_DIR
Definition: winuser.h:1920
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define msg(x)
Definition: auth_time.c:54
#define SetWindowLongPtrW
Definition: winuser.h:5321
#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:1385
#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 1628 of file dialog.c.

1629 {
1630  ULONG_PTR dlgproc, originalproc;
1631  WCHAR buffW[64];
1632  char buff[64];
1633  BOOL ret;
1634  INT len;
1635 
1636  switch (msg)
1637  {
1638  case WM_INITDIALOG:
1639  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1640 
1643  dlg_test_aw_message(hdlg, CB_DIR);
1644  dlg_test_aw_message(hdlg, LB_DIR);
1648 
1649  originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1650  ok(originalproc != (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#lx.\n", originalproc);
1651 
1652  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1653  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#lx.\n", dlgproc);
1654 
1656  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1657 
1658  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1659  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1660 
1661  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1662  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1663 
1664  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1665  ret = SetWindowTextA(hdlg, testtext);
1666  todo_wine
1667  ok(ret, "Failed to set window text.\n");
1668 
1669  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1670  ret = SetWindowTextW(hdlg, testtextW);
1671  todo_wine
1672  ok(ret, "Failed to set window text.\n");
1673 
1674  memset(buff, 'A', sizeof(buff));
1675  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1676  ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
1677 
1678  memset(buffW, 0xff, sizeof(buffW));
1679  len = GetWindowTextW(hdlg, buffW, 64);
1680  ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %s, len %d\n",
1681  wine_dbgstr_w(buffW), len);
1682 
1685  dlg_test_aw_message(hdlg, CB_DIR);
1686  dlg_test_aw_message(hdlg, LB_DIR);
1690 
1692  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1693 
1694  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1695  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1696 
1697  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1698  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1699 
1700  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1701  ret = SetWindowTextA(hdlg, testtext);
1702  todo_wine
1703  ok(ret, "Failed to set window text.\n");
1704 
1705  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1706  ret = SetWindowTextW(hdlg, testtextW);
1707  todo_wine
1708  ok(ret, "Failed to set window text.\n");
1709 
1710  memset(buff, 'A', sizeof(buff));
1711  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1712  ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
1713 
1714  memset(buffW, 0xff, sizeof(buffW));
1715  len = GetWindowTextW(hdlg, buffW, ARRAY_SIZE(buffW));
1716  ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1717  buffW[0], buffW[1], len);
1718 
1721  dlg_test_aw_message(hdlg, CB_DIR);
1722  dlg_test_aw_message(hdlg, LB_DIR);
1726 
1727  SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
1728  EndDialog(hdlg, -123);
1729  return TRUE;
1730  }
1731  return FALSE;
1732 }
#define ULongToHandle(h)
Definition: basetsd.h:81
#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:1330
#define TRUE
Definition: types.h:120
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:4804
int32_t INT
Definition: typedefs.h:58
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1505
uint32_t ULONG_PTR
Definition: typedefs.h:65
static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1457
#define FALSE
Definition: types.h:117
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:4803
__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:162
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
GLenum GLsizei len
Definition: glext.h:6722
#define SetWindowLongPtrA
Definition: winuser.h:5320
static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1407
static const WCHAR testtextW[]
Definition: dialog.c:1384
static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1628
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2091
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
#define CB_DIR
Definition: winuser.h:1920
#define ARRAY_SIZE(a)
Definition: main.h:24
#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:5321
#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:1385
#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 1776 of file dialog.c.

1777 {
1778  BOOL is_unicode = !!lparam;
1779  LONG_PTR oldproc;
1780 
1781  switch (msg)
1782  {
1783  case WM_INITDIALOG:
1784  ok(is_unicode == IsWindowUnicode(hdlg), "Unexpected unicode window property.\n");
1785 
1787  SetWindowLongPtrA(hdlg, GWLP_USERDATA, oldproc);
1788  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1789 
1792  dlg_test_aw_message(hdlg, CB_DIR);
1793  dlg_test_aw_message(hdlg, LB_DIR);
1797 
1799  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1800 
1803  dlg_test_aw_message(hdlg, CB_DIR);
1804  dlg_test_aw_message(hdlg, LB_DIR);
1808 
1809  SetWindowLongPtrA(hdlg, GWLP_WNDPROC, oldproc);
1810  EndDialog(hdlg, -123);
1811  return TRUE;
1812  }
1813  return FALSE;
1814 }
#define LB_DIR
Definition: winuser.h:2015
#define LB_ADDFILE
Definition: winuser.h:2012
#define TRUE
Definition: types.h:120
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1505
#define FALSE
Definition: types.h:117
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:5320
static LRESULT CALLBACK test_aw_conversion_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1734
#define GWLP_WNDPROC
Definition: treelist.c:66
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2091
#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:5321
#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 1407 of file dialog.c.

1408 {
1409  int mode = HandleToULong(GetPropA(hdlg, "test_mode"));
1410  WCHAR *text = (WCHAR *)lparam;
1411  char *textA = (char *)lparam;
1412 
1413  switch (msg)
1414  {
1415  case WM_SETTEXT:
1416  case WM_WININICHANGE:
1417  case WM_DEVMODECHANGE:
1418  case CB_DIR:
1419  case LB_DIR:
1420  case LB_ADDFILE:
1421  case EM_REPLACESEL:
1422  switch (mode)
1423  {
1424  case DLGPROCTEXT_DLGPROCA:
1425  ok(textA == testtext, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A",
1426  testmodes[mode], textA);
1427  break;
1428  case DLGPROCTEXT_DLGPROCW:
1429  ok(text == testtextW, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A", testmodes[mode],
1430  wine_dbgstr_w(text));
1431  break;
1432  case DLGPROCTEXT_SNDMSGA:
1433  case DLGPROCTEXT_SETTEXTA:
1434  if (IsWindowUnicode(hdlg))
1435  {
1437  "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1438  }
1439  else
1440  ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1441  break;
1442  case DLGPROCTEXT_SNDMSGW:
1443  case DLGPROCTEXT_SETTEXTW:
1444  if (IsWindowUnicode(hdlg))
1445  ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1446  else
1447  ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1448  testmodes[mode], textA);
1449  break;
1450  }
1451  break;
1452  };
1453 
1454  return DefWindowProcW(hdlg, msg, wparam, lparam);
1455 }
#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:1397
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:1384
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:1385
#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 1457 of file dialog.c.

1458 {
1459  int mode = HandleToULong(GetPropA(hdlg, "test_mode"));
1460  WCHAR *text = (WCHAR *)lparam;
1461  char *textA = (char *)lparam;
1462 
1463  switch (msg)
1464  {
1465  case WM_SETTEXT:
1466  case WM_WININICHANGE:
1467  case WM_DEVMODECHANGE:
1468  case CB_DIR:
1469  case LB_DIR:
1470  case LB_ADDFILE:
1471  case EM_REPLACESEL:
1472  switch (mode)
1473  {
1474  case DLGPROCTEXT_DLGPROCA:
1475  ok(textA == testtext, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A",
1476  testmodes[mode], textA);
1477  break;
1478  case DLGPROCTEXT_DLGPROCW:
1479  ok(text == testtextW, "%s: %s, unexpected text %s.\n", IsWindowUnicode(hdlg) ? "U" : "A", testmodes[mode],
1480  wine_dbgstr_w(text));
1481  break;
1482  case DLGPROCTEXT_SNDMSGA:
1483  case DLGPROCTEXT_SETTEXTA:
1484  if (IsWindowUnicode(hdlg))
1486  "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1487  else
1488  ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1489  break;
1490  case DLGPROCTEXT_SNDMSGW:
1491  case DLGPROCTEXT_SETTEXTW:
1492  if (IsWindowUnicode(hdlg))
1493  ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1494  else
1495  ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1496  testmodes[mode], textA);
1497  break;
1498  }
1499  break;
1500  }
1501 
1502  return DefWindowProcA(hdlg, msg, wparam, lparam);
1503 }
#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:1397
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:1384
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:1385
#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 1734 of file dialog.c.

1735 {
1737  int mode = HandleToULong(GetPropA(hwnd, "test_mode"));
1738  WCHAR *text = (WCHAR *)lparam;
1739  char *textA = (char *)lparam;
1740 
1741  switch (msg)
1742  {
1743  case WM_SETTEXT:
1744  case WM_WININICHANGE:
1745  case WM_DEVMODECHANGE:
1746  case CB_DIR:
1747  case LB_DIR:
1748  case LB_ADDFILE:
1749  case EM_REPLACESEL:
1750  switch (mode)
1751  {
1752  case DLGPROCTEXT_SNDMSGA:
1753  if (IsWindowUnicode(hwnd))
1755  "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1756  else
1757  ok(textA == testtext, "A: %s, unexpected text %s.\n", testmodes[mode], textA);
1758  break;
1759  case DLGPROCTEXT_SNDMSGW:
1760  if (IsWindowUnicode(hwnd))
1761  ok(text == testtextW, "U: %s, unexpected text %s.\n", testmodes[mode], wine_dbgstr_w(text));
1762  else
1763  ok(textA != testtext && !strcmp(textA, testtext), "A: %s, unexpected text %s.\n",
1764  testmodes[mode], textA);
1765  break;
1766  default:
1767  ok(0, "Unexpected test mode %d.\n", mode);
1768  }
1769  break;
1770  }
1771 
1772  return IsWindowUnicode(hwnd) ? CallWindowProcW(oldproc, hwnd, msg, wparam, lparam) :
1773  CallWindowProcA(oldproc, hwnd, msg, wparam, lparam);
1774 }
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:1397
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:4803
__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:2881
static const WCHAR testtextW[]
Definition: dialog.c:1384
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:1385
#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 551 of file dialog.c.

552 {
553  switch(msg)
554  {
555  case WM_CREATE:
556  {
557  static const short sample[] = { 10,1,2,3,4,5 };
559  short *data = cs->lpCreateParams;
560  ok(!memcmp(data, sample, sizeof(sample)), "data mismatch: %d,%d,%d,%d,%d\n", data[0], data[1], data[2], data[3], data[4]);
561  }
562  return 0;
563 
564  default:
565  break;
566  }
567 
568  return DefWindowProcA(hwnd, msg, wparam, lparam);
569 }
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 2458 of file dialog.c.

2459 {
2460  DialogBoxA(g_hinst, "CUSTOM_TEST_DIALOG", NULL, custom_test_dialog_proc);
2461 }
#define DialogBoxA(i, t, p, f)
Definition: winuser.h:4373
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:2450
static HINSTANCE g_hinst
Definition: dialog.c:48

Referenced by START_TEST().

◆ test_DialogBoxParam()

static void test_DialogBoxParam ( void  )
static

Definition at line 1816 of file dialog.c.

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

Referenced by START_TEST().

◆ test_DisabledDialogTest()

static void test_DisabledDialogTest ( void  )
static

Definition at line 1887 of file dialog.c.

1888 {
1889  g_terminated = FALSE;
1890  DialogBoxParamA(g_hinst, "IDD_DIALOG", NULL, disabled_test_proc, 0);
1891  ok(FALSE == g_terminated, "dialog with disabled ok button has been terminated\n");
1892 }
static LRESULT CALLBACK disabled_test_proc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:492
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
INT_PTR WINAPI DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
Definition: dialog.c:1901
#define ok(value,...)
Definition: atltest.h:57
static BOOL g_terminated
Definition: dialog.c:56
static HINSTANCE g_hinst
Definition: dialog.c:48

Referenced by START_TEST().

◆ test_focus()

static void test_focus ( void  )
static

Definition at line 954 of file dialog.c.

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

Referenced by START_TEST().

◆ test_GetDlgItem()

static void test_GetDlgItem ( void  )
static

Definition at line 1196 of file dialog.c.

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

Referenced by START_TEST().

◆ test_GetDlgItemText()

static void test_GetDlgItemText ( void  )
static

Definition at line 1146 of file dialog.c.

1147 {
1148  char string[64];
1149  BOOL ret;
1150 
1151  strcpy(string, "Overwrite Me");
1152  ret = GetDlgItemTextA(NULL, 0, string, ARRAY_SIZE(string));
1153  ok(!ret, "GetDlgItemText(NULL) shouldn't have succeeded\n");
1154 
1155  ok(string[0] == '\0' || broken(!strcmp(string, "Overwrite Me")),
1156  "string retrieved using GetDlgItemText should have been NULL terminated\n");
1157 }
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:2253
#define ARRAY_SIZE(a)
Definition: main.h:24
#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 348 of file dialog.c.

349 {
350  static test_record test [] =
351  {
352  /* isok test dlg ctl tab prev res */
353 
354  { 1, 1, 6, 0, 0, 1, 0},
355  { 1, 2, 6, 0, 1, 1, 0},
356  { 1, 3, 6, 6, 0, 1, 0},
357  { 1, 4, 6, 6, 1, 1, 0},
358  { 1, 5, 6, 0, 0, 0, 66},
359  { 1, 6, 6, 0, 1, 0, 67},
360  { 1, 7, 6, 6, 0, 0, 66},
361  { 1, 8, 6, 6, 1, 0, 67},
362 
363  { 1, 9, 4, 83, 1, 0, 84},
364  { 1, 10, 4, 83, 0, 0, 5},
365  { 1, 11, 5, 81, 1, 0, 67},
366  { 1, 12, 5, 81, 0, 0, 66},
367  { 1, 13, 5, 82, 1, 1, 78},
368 
369  { 1, 14, 5, 82, 0, 1, 79},
370  { 1, 15, 6, 70, 0, 0, 72},
371  { 1, 16, 6, 72, 0, 0, 25},
372  { 1, 17, 6, 75, 0, 0, 26},
373  { 1, 18, 6, 77, 0, 0, 76},
374  { 1, 19, 6, 79, 0, 0, 66},
375  { 1, 20, 6, 71, 0, 0, 72},
376  { 1, 21, 6, 64, 0, 0, 66},
377 
378  { 1, 22, 6, 25, 0, 0, 70},
379  { 1, 23, 6, 68, 0, 0, 68},
380  { 1, 24, 6, 25, 0, 1, 72},
381  { 1, 25, 1, 70, 0, 0, 72},
382  /*{ 0, 26, 1, 70, 0, 1, 3}, Crashes Win95*/
383  { 1, 27, 1, 70, 1, 0, 72},
384  /*{ 0, 28, 1, 70, 1, 1, 61}, Crashes Win95*/
385 
386  { 1, 29, 6, 67, 1, 0, 72},
387  { 1, 30, 6, 72, 1, 1, 67},
388 
389  { 1, 35, 2, 0, 0, 0, 60},
390  { 1, 36, 2, 0, 1, 0, 60},
391 
392  { 0, 0, 0, 0, 0, 0, 0} /* End of test */
393  };
394  const test_record *p = test;
395 
396  ok (CreateWindows (g_hinst), "Could not create test windows\n");
397 
398  while (p->dlg)
399  {
400  HWND a;
401  a = (p->tab ? GetNextDlgTabItem : GetNextDlgGroupItem) (hwnd[p->dlg], hwnd[p->ctl], p->prev);
402  todo_wine_if (!p->isok)
403  ok (a == hwnd[p->res], "Test %d: %s %s item of %d in %d was %d instead of %d\n", p->test, p->prev ? "Prev" : "Next", p->tab ? "Tab" : "Group", p->ctl, p->dlg, id(a), p->res);
404  p++;
405  }
406 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HWND WINAPI GetNextDlgTabItem(HWND hDlg, HWND hCtl, BOOL bPrevious)
Definition: dialog.c:2406
_In_opt_ PSID Group
Definition: rtlfuncs.h:1605
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:2288
#define todo_wine_if(is_todo)
Definition: test.h:163
#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:155
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:48

Referenced by START_TEST().

◆ test_IsDialogMessage()

static void test_IsDialogMessage ( void  )
static

Definition at line 730 of file dialog.c.

731 {
732  HHOOK hook;
733  MSG msg;
734 
735  g_hwndMain = CreateWindowA("IsDialogMessageWindowClass", "IsDialogMessageWindowClass",
738  NULL, NULL, g_hinst, 0);
739 
740  assert (g_hwndMain);
743 
744  if (0)
745  {
746  /* crashes on Windows */
749  }
750 
751  /* The focus should initially be nowhere. The first TAB should take it
752  * to the first button. The second TAB should take it to the Cancel
753  * button.
754  */
755 
756  /* valid window, invalid message window */
758  FormTabMsg (&msg, (HWND)0xbeefbeef);
759  ok (!IsDialogMessageA(g_hwndMain, &msg), "expected failure\n");
760  ok(g_MSGF_DIALOGBOX, "hook wasn't called\n");
763 
766 
767  ok (!IsDialogMessageA(NULL, &msg), "expected failure\n");
768  ok (!IsDialogMessageA((HWND)0xbeefbeef, &msg), "expected failure\n");
769 
771 
772  ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle first TAB\n");
773  ok ((GetFocus() == g_hwndButton1), "Focus did not move to first button\n");
775  ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle second TAB\n");
777  "Focus did not move to cancel button\n");
779  ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
780  ok (g_terminated, "ENTER did not terminate\n");
781 
782  /* matching but invalid window handles, NULL */
784 
785  FormTabMsg (&msg, NULL);
786  ok (!IsDialogMessageA(msg.hwnd, &msg), "expected failure\n");
787 
788  /* matching but invalid window handles, not NULL */
789  FormTabMsg (&msg, (HWND)0xbeefbeef);
790  ok (!IsDialogMessageA(msg.hwnd, &msg), "expected failure\n");
791 
794 
795  g_hwndMain = CreateWindowA("IsDialogMessageWindowClass", "IsDialogMessageWindowClass", WS_OVERLAPPEDWINDOW,
800  ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
801  ok(g_button1Clicked, "Did not receive button 1 click notification\n");
802 
805  ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
806  ok(g_button1Clicked, "Did not receive button 1 click notification\n");
807 
810  ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
811  ok(g_button1Clicked, "Did not receive button 1 click notification\n");
812 
813  /* Button with id larger than 0xFFFF should also work */
817  ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
818  ok(g_button1Clicked, "Did not receive button 1 click notification\n");
819 
821 }
static HWND g_hwndButtonCancel
Definition: dialog.c:49
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
HWND WINAPI SetFocus(_In_opt_ HWND)
BOOL WINAPI DestroyWindow(_In_ HWND)
HHOOK WINAPI SetWindowsHookExA(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
static void FormEnterMsg(MSG *pMsg, HWND hwnd)
Definition: dialog.c:235
#define FALSE
Definition: types.h:117
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
static BOOL g_button1Clicked
Definition: dialog.c:57
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
static void FormTabMsg(MSG *pMsg, HWND hwnd)
Definition: dialog.c:224
Definition: msg.h:42
static LRESULT CALLBACK hook_proc2(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:723
static BOOL g_MSGF_DIALOGBOX
Definition: dialog.c:722
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define ok(value,...)
Definition: atltest.h:57
static HWND g_hwndMain
Definition: dialog.c:49
HWND WINAPI GetFocus(void)
Definition: window.c:1909
#define msg(x)
Definition: auth_time.c:54
static LRESULT CALLBACK hook_proc(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:716
static BOOL g_terminated
Definition: dialog.c:56
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define SetWindowLongPtrW
Definition: winuser.h:5321
static HWND g_hwndButton1
Definition: dialog.c:49
static HINSTANCE g_hinst
Definition: dialog.c:48
static HWND g_hwndButton2
Definition: dialog.c:49
#define GWLP_ID
Definition: winuser.h:854

Referenced by START_TEST().

◆ test_MessageBox()

static void test_MessageBox ( void  )
static

Definition at line 2379 of file dialog.c.

2380 {
2381  static const struct
2382  {
2383  DWORD mb_style;
2384  DWORD ex_style;
2385  } test[] =
2386  {
2387  { MB_OK, 0 },
2388  { MB_OK | MB_TASKMODAL, 0 },
2390  };
2392  HANDLE thread;
2393  DWORD tid, i;
2394  HHOOK hook;
2395  int ret;
2396 
2398 
2399  ret = MessageBoxA(NULL, "Text", "MSGBOX caption", MB_OKCANCEL);
2400  ok(ret == IDCANCEL, "got %d\n", ret);
2401 
2403 
2404  sprintf(params.caption, "pid %08x, tid %08x, time %08x",
2406 
2407  params.owner = FALSE;
2408 
2409  for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
2410  {
2411  HWND hwnd;
2412  DWORD ex_style;
2413 
2414  params.style = test[i].mb_style;
2415 
2417 
2418  hwnd = wait_for_window(params.caption);
2419  ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
2420  ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style);
2421 
2423 
2424  ok(WaitForSingleObject(thread, 5000) != WAIT_TIMEOUT, "thread failed to terminate\n");
2426  }
2427 
2428  params.owner = TRUE;
2429 
2430  for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
2431  {
2432  HWND hwnd;
2433  DWORD ex_style;
2434 
2435  params.style = test[i].mb_style;
2436 
2438 
2439  hwnd = wait_for_window(params.caption);
2440  ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
2441  ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style);
2442 
2444 
2445  ok(WaitForSingleObject(thread, 5000) != WAIT_TIMEOUT, "thread failed to terminate\n");
2447  }
2448 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CloseHandle
Definition: compat.h:487
#define TRUE
Definition: types.h:120
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:2062
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define FALSE
Definition: types.h:117
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:2338
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:44
#define ok(value,...)
Definition: atltest.h:57
static HWND wait_for_window(const char *caption)
Definition: dialog.c:2356
static LRESULT CALLBACK msgbox_hook_proc(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:2303
#define 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_MessageBox_WM_COPY_Test()

static void test_MessageBox_WM_COPY_Test ( void  )
static

Definition at line 2144 of file dialog.c.

2145 {
2146  DWORD tid = 0;
2147 
2149  trace("non_english %d\n", non_english);
2150 
2152  MessageBoxA(NULL, "Message", msgbox_title, MB_OK);
2153 
2155  MessageBoxA(NULL, "Message", msgbox_title, MB_OKCANCEL);
2156 
2159 
2161  MessageBoxA(NULL, "Message", msgbox_title, MB_YESNO);
2162 
2165 
2168 
2171 }
static WCHAR expectedAbortRetryIgnore[]
Definition: dialog.c:2017
int WINAPI MessageBoxA(_In_opt_ HWND, _In_opt_ LPCSTR, _In_opt_ LPCSTR, _In_ UINT)
#define MB_YESNO
Definition: winuser.h:811
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
DWORD WINAPI WorkerThread(void *param)
Definition: dialog.c:2081
#define MB_YESNOCANCEL
Definition: winuser.h:812
#define MB_OKCANCEL
Definition: winuser.h:798
BOOL non_english
Definition: dialog.c:2079
#define trace
Definition: atltest.h:70
static WCHAR expectedOkCancel[]
Definition: dialog.c:2005
static WCHAR expectedRetryCancel[]
Definition: dialog.c:2054
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LANG_ENGLISH
Definition: nls.h:52
static const char msgbox_title[]
Definition: dialog.c:1992
static WCHAR expectedCancelTryContinue[]
Definition: dialog.c:2066
#define MB_ABORTRETRYIGNORE
Definition: winuser.h:785
static WCHAR expectedOK[]
Definition: dialog.c:1993
#define MB_OK
Definition: winuser.h:784
#define MB_CANCELTRYCONTINUE
Definition: vfdguiut.c:34
#define MB_RETRYCANCEL
Definition: winuser.h:799
LANGID WINAPI GetUserDefaultLangID(void)
Definition: lang.c:734
static TfClientId tid
static WCHAR expectedYesNoCancel[]
Definition: dialog.c:2042
static WCHAR expectedYesNo[]
Definition: dialog.c:2030
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by START_TEST().

◆ test_MessageBoxFontTest()

static void test_MessageBoxFontTest ( void  )
static

Definition at line 1905 of file dialog.c.

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

Referenced by START_TEST().

◆ test_SaveRestoreFocus()

static void test_SaveRestoreFocus ( void  )
static

Definition at line 2173 of file dialog.c.

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

Referenced by START_TEST().

◆ test_timer_message()

static void test_timer_message ( void  )
static

Definition at line 2298 of file dialog.c.

2299 {
2300  DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc);
2301 }
#define DialogBoxA(i, t, p, f)
Definition: winuser.h:4373
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:2254
static HINSTANCE g_hinst
Definition: dialog.c:48

Referenced by START_TEST().

◆ test_WM_NEXTDLGCTL()

static void test_WM_NEXTDLGCTL ( void  )
static

Definition at line 604 of file dialog.c.

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

Referenced by START_TEST().

◆ TestControlStyleDlgProc()

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

Definition at line 1348 of file dialog.c.

1350 {
1351  HWND control;
1352  DWORD style, exstyle;
1353  char buf[256];
1354 
1355  switch (msg)
1356  {
1357  case WM_INITDIALOG:
1358  control = GetDlgItem(hdlg, 7);
1359  ok(control != 0, "dialog control with id 7 not found\n");
1360  style = GetWindowLongA(control, GWL_STYLE);
1361  ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#x\n", style);
1362  exstyle = GetWindowLongA(control, GWL_EXSTYLE);
1363  ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT|WS_EX_CLIENTEDGE, got %#x\n", exstyle);
1364  buf[0] = 0;
1365  GetWindowTextA(control, buf, sizeof(buf));
1366  ok(strcmp(buf, "bump7") == 0, "expected bump7, got %s\n", buf);
1367 
1368  control = GetDlgItem(hdlg, 8);
1369  ok(control != 0, "dialog control with id 8 not found\n");
1370  style = GetWindowLongA(control, GWL_STYLE);
1371  ok(style == (WS_CHILD|WS_VISIBLE), "expected WS_CHILD|WS_VISIBLE, got %#x\n", style);
1372  exstyle = GetWindowLongA(control, GWL_EXSTYLE);
1373  ok(exstyle == (WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT), "expected WS_EX_NOPARENTNOTIFY|WS_EX_TRANSPARENT, got %#x\n", exstyle);
1374  buf[0] = 0;
1375  GetWindowTextA(control, buf, sizeof(buf));
1376  ok(strcmp(buf, "bump8") == 0, "expected bump8, got %s\n", buf);
1377 
1378  EndDialog(hdlg, -7);
1379  return TRUE;
1380  }
1381  return FALSE;
1382 }
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1330
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TRUE
Definition: types.h:120
#define WS_EX_TRANSPARENT
Definition: pedump.c:649
#define GWL_EXSTYLE
Definition: winuser.h:845
#define WS_CHILD
Definition: pedump.c:617
#define FALSE
Definition: types.h:117
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:2091
#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:2189
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 1296 of file dialog.c.

1298 {
1299  switch (uiMsg)
1300  {
1301  case WM_INITDIALOG:
1302  EndDialog(hDlg, LOWORD(SendMessageA(hDlg, DM_GETDEFID, 0, 0)));
1303  return TRUE;
1304  }
1305  return FALSE;
1306 }
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DM_GETDEFID
Definition: winuser.h:2080
#define FALSE
Definition: types.h:117
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2091