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

Enumerations

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

Functions

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

◆ WINVER

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

Definition at line 33 of file dialog.c.

Enumeration Type Documentation

◆ defdlgproc_text

Enumerator
DLGPROCTEXT_SNDMSGA 
DLGPROCTEXT_SNDMSGW 
DLGPROCTEXT_DLGPROCA 
DLGPROCTEXT_DLGPROCW 
DLGPROCTEXT_SETTEXTA 
DLGPROCTEXT_SETTEXTW 

Definition at line 1391 of file dialog.c.

Function Documentation

◆ create_window_thread()

static DWORD WINAPI create_window_thread ( void param)
static

Definition at line 2342 of file dialog.c.

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

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

2455 {
2456  if (msg == WM_INITDIALOG)
2457  EndDialog(hdlg, 0);
2458 
2459  return FALSE;
2460 }
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2085
#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 828 of file dialog.c.

830 {
831  switch (uiMsg)
832  {
833  case WM_INITDIALOG:
834  g_hwndMain = hDlg;
836  g_hwndButton1 = GetDlgItem(hDlg,200);
837  g_hwndButton2 = GetDlgItem(hDlg,201);
840 
841  /* Initially check the second radio button */
844  /* Continue testing after dialog initialization */
845  PostMessageA(hDlg, WM_USER, 0, 0);
847 
848  case WM_COMMAND:
849  if (LOWORD(wParam) == IDCANCEL)
850  {
851  EndDialog(hDlg, LOWORD(wParam));
852  return TRUE;
853  }
854  return FALSE;
855 
856  case WM_USER:
859  SetFocus(hDlg);
861  PostMessageA(hDlg, WM_COMMAND, IDCANCEL, 0);
862  return TRUE;
863  }
864 
865  return FALSE;
866 }
#define TRUE
Definition: types.h:120
static HWND g_hwndButtonCancel
Definition: dialog.c:53
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static HWND g_hwndInitialFocusT2
Definition: dialog.c:55
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:57
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
#define BM_SETCHECK
Definition: winuser.h:1903
static HWND g_hwndInitialFocusGroupBox
Definition: dialog.c:55
#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:2085
static HWND g_hwndMain
Definition: dialog.c:53
#define BST_CHECKED
Definition: winuser.h:197
HWND WINAPI GetFocus(void)
Definition: window.c:1905
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2183
#define IDCANCEL
Definition: winuser.h:825
static HWND g_hwndButton1
Definition: dialog.c:53
static BOOL g_bInitialFocusInitDlgResult
Definition: dialog.c:58
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LOWORD(l)
Definition: pedump.c:82
static HWND g_hwndButton2
Definition: dialog.c:53
static LONG g_styleInitialFocusT2
Definition: dialog.c:57
static HWND g_hwndInitialFocusT1
Definition: dialog.c:55

Referenced by test_focus().

◆ DestroyDlgWinProc()

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

Definition at line 1255 of file dialog.c.

1257 {
1258  if (uiMsg == WM_INITDIALOG)
1259  {
1260  DestroyWindow(hDlg);
1261  return TRUE;
1262  }
1263  return FALSE;
1264 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WM_INITDIALOG
Definition: winuser.h:1721

Referenced by test_DialogBoxParam().

◆ DestroyOnCloseDlgWinProc()

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

Definition at line 1266 of file dialog.c.

1268 {
1269  switch (uiMsg)
1270  {
1271  case WM_INITDIALOG:
1272  PostMessageA(hDlg, WM_CLOSE, 0, 0);
1273  return TRUE;
1274  case WM_CLOSE:
1275  DestroyWindow(hDlg);
1276  return TRUE;
1277  case WM_DESTROY:
1278  PostQuitMessage(0);
1279  return TRUE;
1280  }
1281  return FALSE;
1282 }
#define TRUE
Definition: types.h:120
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyWindow(_In_ HWND)
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_INITDIALOG
Definition: winuser.h:1721
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by test_DialogBoxParam().

◆ disabled_test_proc()

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

Definition at line 496 of file dialog.c.

498 {
499  switch (uiMsg)
500  {
501  case WM_INITDIALOG:
502  {
503  DWORD dw;
504  HWND hwndOk;
505 
506  dw = SendMessageA(hwnd, DM_GETDEFID, 0, 0);
508  hwndOk = GetDlgItem(hwnd, LOWORD(dw));
509  assert(hwndOk);
510  EnableWindow(hwndOk, FALSE);
511 
514  break;
515  }
516  case WM_COMMAND:
517  if (wParam == IDOK)
518  {
519  g_terminated = TRUE;
520  EndDialog(hwnd, 0);
521  return 0;
522  }
523  else if (wParam == IDCANCEL)
524  {
525  EndDialog(hwnd, 0);
526  return 0;
527  }
528  break;
529  }
530 
531  return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
532 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define assert(x)
Definition: debug.h:53
#define VK_RETURN
Definition: winuser.h:2176
WPARAM wParam
Definition: combotst.c:138
#define DM_GETDEFID
Definition: winuser.h:2080
#define DC_HASDEFID
Definition: winuser.h:2584
#define WM_KEYDOWN
Definition: winuser.h:1697
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID LPVOID DWORD dw
Definition: atlbase.h:40
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2085
static BOOL g_terminated
Definition: dialog.c:60
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2183
#define HIWORD(l)
Definition: typedefs.h:246
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by test_DisabledDialogTest().

◆ dlg_test_aw_message()

static void dlg_test_aw_message ( HWND  hdlg,
UINT  msg 
)
static

Definition at line 1509 of file dialog.c.

1510 {
1511  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SNDMSGA));
1512  SendMessageA(hdlg, msg, 0, (LPARAM)testtext);
1513 
1514  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SNDMSGW));
1515  SendMessageW(hdlg, msg, 0, (LPARAM)testtextW);
1516 
1517  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_DLGPROCA));
1518  DefDlgProcA(hdlg, msg, 0, (LPARAM)testtext);
1519 
1520  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_DLGPROCW));
1521  DefDlgProcW(hdlg, msg, 0, (LPARAM)testtextW);
1522 }
#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:1776
LONG_PTR LPARAM
Definition: windef.h:208
LRESULT WINAPI DefDlgProcA(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1713
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
static const WCHAR testtextW[]
Definition: dialog.c:1388
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:1389

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

890 {
891  switch(uMsg) {
892  case WM_INITDIALOG:
893  return TRUE;
894  }
895  return FALSE;
896 }
#define TRUE
Definition: types.h:120
#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 898 of file dialog.c.

900 {
901  static HWND hChildDlg;
902 
903  switch (uiMsg)
904  {
905  case WM_INITDIALOG:
906  {
907  RECT rectHwnd;
908  struct {
909  DLGTEMPLATE tmplate;
910  WORD menu,class,title;
911  } temp;
912 
913  SetFocus( GetDlgItem(hwnd, 200) );
914 
915  GetClientRect(hwnd,&rectHwnd);
917  temp.tmplate.dwExtendedStyle = 0;
918  temp.tmplate.cdit = 0;
919  temp.tmplate.x = 0;
920  temp.tmplate.y = 0;
921  temp.tmplate.cx = 0;
922  temp.tmplate.cy = 0;
923  temp.menu = temp.class = temp.title = 0;
924 
925  hChildDlg = CreateDialogIndirectParamA(g_hinst, &temp.tmplate,
927  ok(hChildDlg != 0, "Failed to create test dialog.\n");
928 
929  return FALSE;
930  }
931  case WM_CLOSE:
932  DestroyWindow(hChildDlg);
933  return TRUE;
934  }
935 
936  return FALSE;
937 }
#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:1639
#define WS_CHILD
Definition: pedump.c:617
static INT_PTR CALLBACK EmptyProcUserTemplate(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:889
BOOL WINAPI DestroyWindow(_In_ HWND)
#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:2183
#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:52

Referenced by test_focus().

◆ focusDlgWinProc()

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

Definition at line 868 of file dialog.c.

870 {
871  switch (uiMsg)
872  {
873  case WM_INITDIALOG:
874  SetWindowTextA(GetDlgItem(hDlg, 200), "new caption");
875  return TRUE;
876 
877  case WM_COMMAND:
878  if (LOWORD(wParam) == 200)
879  {
880  if (HIWORD(wParam) == EN_SETFOCUS)
882  }
883  return FALSE;
884  }
885 
886  return FALSE;
887 }
#define TRUE
Definition: types.h:120
HANDLE HWND
Definition: compat.h:13
WPARAM wParam
Definition: combotst.c:138
#define EN_SETFOCUS
Definition: winuser.h:2009
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)
#define WM_COMMAND
Definition: winuser.h:1722
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2183
#define HIWORD(l)
Definition: typedefs.h:246
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
static HWND g_hwndInitialFocusT1
Definition: dialog.c:55

Referenced by test_focus().

◆ FormEnterMsg()

static void FormEnterMsg ( MSG pMsg,
HWND  hwnd 
)
static

Definition at line 239 of file dialog.c.

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

Referenced by test_IsDialogMessage(), and test_WM_NEXTDLGCTL().

◆ FormTabMsg()

static void FormTabMsg ( MSG pMsg,
HWND  hwnd 
)
static

Definition at line 228 of file dialog.c.

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

Referenced by test_IsDialogMessage().

◆ get_button_style()

static DWORD get_button_style ( HWND  button)
static

Definition at line 154 of file dialog.c.

155 {
157 }
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 1163 of file dialog.c.

1164 {
1165  if (msg == WM_INITDIALOG)
1166  {
1167  char text[64];
1168  LONG_PTR val;
1169  HWND hwnd;
1170  BOOL ret;
1171 
1172  hwnd = GetDlgItem(hdlg, -1);
1173  ok(hwnd != NULL, "Expected dialog item.\n");
1174 
1175  *text = 0;
1176  ret = GetDlgItemTextA(hdlg, -1, text, ARRAY_SIZE(text));
1177  ok(ret && !strcmp(text, "Text1"), "Unexpected item text.\n");
1178 
1180  ok(val == -1, "Unexpected id.\n");
1181 
1183  ok(val == -1, "Unexpected id %ld.\n", val);
1184 
1185  hwnd = GetDlgItem(hdlg, -2);
1186  ok(hwnd != NULL, "Expected dialog item.\n");
1187 
1189  ok(val == -2, "Unexpected id.\n");
1190 
1192  ok(val == -2, "Unexpected id %ld.\n", val);
1193 
1194  EndDialog(hdlg, 0xdead);
1195  }
1196 
1197  return FALSE;
1198 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
const WCHAR * text
Definition: package.c:1827
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:2247
static HWND hwnd[MAXHWNDS]
Definition: dialog.c:48
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2085
#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:2183
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 940 of file dialog.c.

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

Referenced by test_focus().

◆ hook_proc()

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

Definition at line 720 of file dialog.c.

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

Referenced by test_IsDialogMessage().

◆ hook_proc2()

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

Definition at line 727 of file dialog.c.

728 {
729  ok(code == MSGF_DIALOGBOX, "unexpected hook called, code %d\n", code);
731  return CallNextHookEx(NULL, code, wParam, lParam);
732 }
#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:726
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 265 of file dialog.c.

266 {
267  unsigned int i;
268  for (i = 0; i < numwnds; i++)
269  if (hwnd[i] == h)
270  return i;
271  return -1;
272 }
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:49

Referenced by DIALOG_GetControl32().

◆ KeyDownData()

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

Definition at line 221 of file dialog.c.

222 {
223  return ((repeat & 0x0000FFFF) | ((scancode & 0x00FF) << 16) |
224  (extended ? 0x01000000 : 0) | (wasdown ? 0x40000000 : 0));
225 }
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 466 of file dialog.c.

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

1900 {
1901  if (uiMsg == WM_INITDIALOG) {
1902  SetFocus(hDlg);
1903  return 1;
1904  }
1905 
1906  return 0;
1907 }
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 2307 of file dialog.c.

2308 {
2309  if (code == HCBT_ACTIVATE)
2310  {
2311  HWND msgbox = (HWND)wParam, msghwnd;
2312  char text[64];
2313 
2314  if (msgbox)
2315  {
2316  text[0] = 0;
2317  GetWindowTextA(msgbox, text, sizeof(text));
2318  ok(!strcmp(text, "MSGBOX caption"), "Unexpected window text \"%s\"\n", text);
2319 
2320  msghwnd = GetDlgItem(msgbox, 0xffff);
2321  ok(msghwnd != NULL, "Expected static control\n");
2322 
2323  text[0] = 0;
2324  GetWindowTextA(msghwnd, text, sizeof(text));
2325  ok(!strcmp(text, "Text"), "Unexpected window text \"%s\"\n", text);
2326 
2328  SendDlgItemMessageA(msgbox, IDCANCEL, WM_LBUTTONUP, 0, 0);
2329  }
2330  }
2331 
2332  return CallNextHookEx(NULL, code, wParam, lParam);
2333 }
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
const WCHAR * text
Definition: package.c:1827
HANDLE HWND
Definition: compat.h:13
WPARAM wParam
Definition: combotst.c:138
smooth NULL
Definition: ftsmooth.c:416
LRESULT WINAPI SendDlgItemMessageA(HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:2750
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:2183
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 415 of file dialog.c.

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

Referenced by main_window_procA().

◆ OnTestDlgCreate()

static BOOL OnTestDlgCreate ( HWND  hwnd,
LPCREATESTRUCTA  lpcs 
)
static

Definition at line 440 of file dialog.c.

441 {
444  "Edit", "Edit",
446  16,33,184,24, hwnd, (HMENU)101, g_hinst, 0);
447  if (!g_hwndTestDlgEdit) return FALSE;
448 
451  "button", "Button &1",
453  204,33,30,24, hwnd, (HMENU)201, g_hinst, 0);
454  if (!g_hwndTestDlgBut1) return FALSE;
455 
457  | WS_EX_NOPARENTNOTIFY, "button",
458  "Button &2",
460  90,102,80,24, hwnd, (HMENU)IDCANCEL, g_hinst, 0);
461  if (!g_hwndTestDlgBut2) return FALSE;
462 
463  return TRUE;
464 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HWND g_hwndTestDlgBut1
Definition: dialog.c:54
#define TRUE
Definition: types.h:120
static HWND g_hwndTestDlgBut2
Definition: dialog.c:54
#define WS_EX_LTRREADING
Definition: winuser.h:393
#define BS_TEXT
Definition: winuser.h:276
static HWND g_hwndTestDlgEdit
Definition: dialog.c:54
#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:52

Referenced by testDlgWinProc().

◆ RegisterWindowClasses()

static BOOL RegisterWindowClasses ( void  )
static

Definition at line 575 of file dialog.c.

576 {
577  WNDCLASSA cls;
578 
579  cls.style = 0;
581  cls.cbClsExtra = 0;
582  cls.cbWndExtra = 0;
583  cls.hInstance = g_hinst;
584  cls.hIcon = NULL;
586  cls.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
587  cls.lpszMenuName = NULL;
588  cls.lpszClassName = "GetNextDlgItemWindowClass";
589 
590  if (!RegisterClassA (&cls)) return FALSE;
591 
593  cls.lpszClassName = "IsDialogMessageWindowClass";
594  if (!RegisterClassA (&cls)) return FALSE;
595 
597  cls.lpszClassName = "TESTCONTROL";
598  if (!RegisterClassA (&cls)) return FALSE;
599 
600  GetClassInfoA(0, "#32770", &cls);
602  cls.lpszClassName = "WM_NEXTDLGCTLWndClass";
603  if (!RegisterClassA (&cls)) return FALSE;
604 
605  return TRUE;
606 }
#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
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:555
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:466
HINSTANCE hInstance
Definition: winuser.h:3142
static LRESULT CALLBACK testDlgWinProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:534
WNDPROC lpfnWndProc
Definition: winuser.h:3139
#define IDC_ARROW
Definition: winuser.h:682
static HINSTANCE g_hinst
Definition: dialog.c:52
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HICON hIcon
Definition: winuser.h:3143

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dialog  )

Definition at line 2467 of file dialog.c.

2468 {
2469  g_hinst = GetModuleHandleA (0);
2470 
2471  if (!RegisterWindowClasses()) assert(0);
2472 
2477  test_focus();
2478  test_GetDlgItem();
2485  test_MessageBox();
2487 }
static void test_DisabledDialogTest(void)
Definition: dialog.c:1891
static void test_GetNextDlgItem(void)
Definition: dialog.c:352
static void test_SaveRestoreFocus(void)
Definition: dialog.c:2177
static void test_WM_NEXTDLGCTL(void)
Definition: dialog.c:608
static void test_DialogBoxParam(void)
Definition: dialog.c:1820
#define assert(x)
Definition: debug.h:53
static void test_MessageBox_WM_COPY_Test(void)
Definition: dialog.c:2148
static void test_GetDlgItemText(void)
Definition: dialog.c:1150
static void test_GetDlgItem(void)
Definition: dialog.c:1200
static void test_MessageBoxFontTest(void)
Definition: dialog.c:1909
static void test_MessageBox(void)
Definition: dialog.c:2383
static void test_IsDialogMessage(void)
Definition: dialog.c:734
static void test_focus(void)
Definition: dialog.c:958
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
static BOOL RegisterWindowClasses(void)
Definition: dialog.c:575
static void test_dialog_custom_data(void)
Definition: dialog.c:2462
static void test_timer_message(void)
Definition: dialog.c:2302
static HINSTANCE g_hinst
Definition: dialog.c:52

◆ test_aw_conversion_dlgproc()

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

Definition at line 1524 of file dialog.c.

1525 {
1526  ULONG_PTR dlgproc, originalproc;
1527  WCHAR buffW[64];
1528  char buff[64];
1529  BOOL ret;
1530  INT len;
1531 
1532  switch (msg)
1533  {
1534  case WM_INITDIALOG:
1535  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1536 
1539  dlg_test_aw_message(hdlg, CB_DIR);
1540  dlg_test_aw_message(hdlg, LB_DIR);
1544 
1545  /* WM_SETTEXT/WM_GETTEXT */
1546  originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1547  ok(originalproc == (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", originalproc);
1548 
1549  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1550  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgproc, "Unexpected dlg proc %#lx.\n", dlgproc);
1551 
1553  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1554 
1555  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1556  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1557 
1558  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1559  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1560 
1561  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1562  ret = SetWindowTextA(hdlg, testtext);
1563  todo_wine
1564  ok(ret, "Failed to set window text.\n");
1565 
1566  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1567  ret = SetWindowTextW(hdlg, testtextW);
1568  todo_wine
1569  ok(ret, "Failed to set window text.\n");
1570 
1571  memset(buff, 'A', sizeof(buff));
1572  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1573  ok(buff[0] == 0 && buff[1] == 'A' && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1574  (BYTE)buff[0], (BYTE)buff[1], len);
1575 
1576  memset(buffW, 0xff, sizeof(buffW));
1577  len = GetWindowTextW(hdlg, buffW, 64);
1578  ok(!lstrcmpW(buffW, testtextW) && len == 0, "Unexpected window text %s, len %d\n", wine_dbgstr_w(buffW), len);
1579 
1582  dlg_test_aw_message(hdlg, CB_DIR);
1583  dlg_test_aw_message(hdlg, LB_DIR);
1587 
1589  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1590 
1591  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1592  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1593 
1594  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1595  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1596 
1597  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1598  ret = SetWindowTextA(hdlg, testtext);
1599  todo_wine
1600  ok(ret, "Failed to set window text.\n");
1601 
1602  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1603  ret = SetWindowTextW(hdlg, testtextW);
1604  todo_wine
1605  ok(ret, "Failed to set window text.\n");
1606 
1607  memset(buff, 'A', sizeof(buff));
1608  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1609  ok(buff[0] == 0 && buff[1] == 'A' && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1610  (BYTE)buff[0], (BYTE)buff[1], len);
1611 
1612  memset(buffW, 0xff, sizeof(buffW));
1613  len = GetWindowTextW(hdlg, buffW, ARRAY_SIZE(buffW));
1614  ok(buffW[0] == 'W' && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1615  buffW[0], buffW[1], len);
1616 
1619  dlg_test_aw_message(hdlg, CB_DIR);
1620  dlg_test_aw_message(hdlg, LB_DIR);
1624 
1625  SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
1626  EndDialog(hdlg, -123);
1627  return TRUE;
1628  }
1629  return FALSE;
1630 }
#define ULongToHandle(h)
Definition: basetsd.h:81
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:2015
#define DWLP_DLGPROC
Definition: winuser.h:865
#define LB_ADDFILE
Definition: winuser.h:2012
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4804
int32_t INT
Definition: typedefs.h:56
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1509
uint32_t ULONG_PTR
Definition: typedefs.h:63
static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1461
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:163
BOOL WINAPI SetPropA(_In_ HWND, _In_ LPCSTR, _In_opt_ HANDLE)
GLenum GLsizei len
Definition: glext.h:6722
#define SetWindowLongPtrA
Definition: winuser.h:5320
unsigned char BYTE
Definition: mem.h:68
static INT_PTR CALLBACK test_aw_conversion_dlgprocA(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1411
static const WCHAR testtextW[]
Definition: dialog.c:1388
static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1524
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2085
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
#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:1389
#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 1632 of file dialog.c.

1633 {
1634  ULONG_PTR dlgproc, originalproc;
1635  WCHAR buffW[64];
1636  char buff[64];
1637  BOOL ret;
1638  INT len;
1639 
1640  switch (msg)
1641  {
1642  case WM_INITDIALOG:
1643  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1644 
1647  dlg_test_aw_message(hdlg, CB_DIR);
1648  dlg_test_aw_message(hdlg, LB_DIR);
1652 
1653  originalproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1654  ok(originalproc != (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#lx.\n", originalproc);
1655 
1656  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1657  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgproc2, "Unexpected dlg proc %#lx.\n", dlgproc);
1658 
1660  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1661 
1662  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1663  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1664 
1665  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1666  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocW, "Unexpected dlg proc %#lx.\n", dlgproc);
1667 
1668  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1669  ret = SetWindowTextA(hdlg, testtext);
1670  todo_wine
1671  ok(ret, "Failed to set window text.\n");
1672 
1673  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1674  ret = SetWindowTextW(hdlg, testtextW);
1675  todo_wine
1676  ok(ret, "Failed to set window text.\n");
1677 
1678  memset(buff, 'A', sizeof(buff));
1679  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1680  ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
1681 
1682  memset(buffW, 0xff, sizeof(buffW));
1683  len = GetWindowTextW(hdlg, buffW, 64);
1684  ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %s, len %d\n",
1685  wine_dbgstr_w(buffW), len);
1686 
1689  dlg_test_aw_message(hdlg, CB_DIR);
1690  dlg_test_aw_message(hdlg, LB_DIR);
1694 
1696  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1697 
1698  dlgproc = GetWindowLongPtrW(hdlg, DWLP_DLGPROC);
1699  ok(dlgproc == (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1700 
1701  dlgproc = GetWindowLongPtrA(hdlg, DWLP_DLGPROC);
1702  ok(dlgproc != (ULONG_PTR)test_aw_conversion_dlgprocA, "Unexpected dlg proc %#lx.\n", dlgproc);
1703 
1704  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTA));
1705  ret = SetWindowTextA(hdlg, testtext);
1706  todo_wine
1707  ok(ret, "Failed to set window text.\n");
1708 
1709  SetPropA(hdlg, "test_mode", ULongToHandle(DLGPROCTEXT_SETTEXTW));
1710  ret = SetWindowTextW(hdlg, testtextW);
1711  todo_wine
1712  ok(ret, "Failed to set window text.\n");
1713 
1714  memset(buff, 'A', sizeof(buff));
1715  len = GetWindowTextA(hdlg, buff, sizeof(buff));
1716  ok(!strcmp(buff, testtext) && len == 0, "Unexpected window text %s, len %d\n", buff, len);
1717 
1718  memset(buffW, 0xff, sizeof(buffW));
1719  len = GetWindowTextW(hdlg, buffW, ARRAY_SIZE(buffW));
1720  ok(buffW[0] == 0 && buffW[1] == 0xffff && len == 0, "Unexpected window text %#x, %#x, len %d\n",
1721  buffW[0], buffW[1], len);
1722 
1725  dlg_test_aw_message(hdlg, CB_DIR);
1726  dlg_test_aw_message(hdlg, LB_DIR);
1730 
1731  SetWindowLongPtrA(hdlg, DWLP_DLGPROC, originalproc);
1732  EndDialog(hdlg, -123);
1733  return TRUE;
1734  }
1735  return FALSE;
1736 }
#define ULongToHandle(h)
Definition: basetsd.h:81
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:2015
#define DWLP_DLGPROC
Definition: winuser.h:865
#define LB_ADDFILE
Definition: winuser.h:2012
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1326
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
#define GetWindowLongPtrW
Definition: winuser.h:4804
int32_t INT
Definition: typedefs.h:56
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1509
uint32_t ULONG_PTR
Definition: typedefs.h:63
static INT_PTR CALLBACK test_aw_conversion_dlgprocW(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1461
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:163
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:1411
static const WCHAR testtextW[]
Definition: dialog.c:1388
static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1632
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2085
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1408
#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:1389
#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 1780 of file dialog.c.

1781 {
1782  BOOL is_unicode = !!lparam;
1783  LONG_PTR oldproc;
1784 
1785  switch (msg)
1786  {
1787  case WM_INITDIALOG:
1788  ok(is_unicode == IsWindowUnicode(hdlg), "Unexpected unicode window property.\n");
1789 
1791  SetWindowLongPtrA(hdlg, GWLP_USERDATA, oldproc);
1792  ok(!IsWindowUnicode(hdlg), "Unexpected unicode window.\n");
1793 
1796  dlg_test_aw_message(hdlg, CB_DIR);
1797  dlg_test_aw_message(hdlg, LB_DIR);
1801 
1803  ok(IsWindowUnicode(hdlg), "Expected unicode window.\n");
1804 
1807  dlg_test_aw_message(hdlg, CB_DIR);
1808  dlg_test_aw_message(hdlg, LB_DIR);
1812 
1813  SetWindowLongPtrA(hdlg, GWLP_WNDPROC, oldproc);
1814  EndDialog(hdlg, -123);
1815  return TRUE;
1816  }
1817  return FALSE;
1818 }
#define TRUE
Definition: types.h:120
#define LB_DIR
Definition: winuser.h:2015
#define LB_ADDFILE
Definition: winuser.h:2012
#define WM_DEVMODECHANGE
Definition: winuser.h:1613
static void dlg_test_aw_message(HWND hdlg, UINT msg)
Definition: dialog.c:1509
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:1738
#define GWLP_WNDPROC
Definition: treelist.c:66
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2085
#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 1411 of file dialog.c.

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

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

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

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

2463 {
2464  DialogBoxA(g_hinst, "CUSTOM_TEST_DIALOG", NULL, custom_test_dialog_proc);
2465 }
#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:2454
static HINSTANCE g_hinst
Definition: dialog.c:52

Referenced by START_TEST().

◆ test_DialogBoxParam()

static void test_DialogBoxParam ( void  )
static

Definition at line 1820 of file dialog.c.

1821 {
1822  static const WCHAR nameW[] = {'T','E','S','T','_','E','M','P','T','Y','_','D','I','A','L','O','G',0};
1823  INT_PTR ret;
1824  HWND hwnd_invalid = (HWND)0x4444;
1825 
1826  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DLG_CHILD_POPUP", 0, TestControlStyleDlgProc, 0);
1827  ok(ret == -7, "expected -7, got %ld\n", ret);
1828 
1829  SetLastError(0xdeadbeef);
1830  ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_DIALOG" , hwnd_invalid, 0 , 0);
1831  ok(0 == ret || broken(ret == -1), "DialogBoxParamA returned %ld, expected 0\n", ret);
1833  broken(GetLastError() == 0xdeadbeef),
1834  "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
1835 
1836  /* Test a dialog which destroys itself on WM_INITDIALOG. */
1837  SetLastError(0xdeadbeef);
1838  ret = DialogBoxParamA(GetModuleHandleA(NULL), "IDD_DIALOG", 0, DestroyDlgWinProc, 0);
1839  ok(-1 == ret, "DialogBoxParamA returned %ld, expected -1\n", ret);
1841  GetLastError() == ERROR_SUCCESS ||
1842  broken(GetLastError() == 0xdeadbeef),
1843  "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n",GetLastError());
1844 
1845  /* Test a dialog which destroys itself on WM_CLOSE. */
1847  ok(0 == ret, "DialogBoxParamA returned %ld, expected 0\n", ret);
1848 
1849  SetLastError(0xdeadbeef);
1850  ret = DialogBoxParamA(GetModuleHandleA(NULL), "RESOURCE_INVALID" , 0, 0, 0);
1851  ok(-1 == ret, "DialogBoxParamA returned %ld, expected -1\n", ret);
1853  broken(GetLastError() == 0xdeadbeef),
1854  "got %d, expected ERROR_RESOURCE_NAME_NOT_FOUND\n",GetLastError());
1855 
1856  SetLastError(0xdeadbeef);
1857  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_DIALOG_INVALID_CLASS", 0, DestroyDlgWinProc, 0);
1858  ok(ret == -1, "DialogBoxParamA returned %ld, expected -1\n", ret);
1859  ok(GetLastError() == 0, "got %d\n", GetLastError());
1860 
1861  SetLastError(0xdeadbeef);
1862  ret = DefDlgProcA(0, WM_ERASEBKGND, 0, 0);
1863  ok(ret == 0, "DefDlgProcA returned %ld, expected 0\n", ret);
1865  broken(GetLastError() == 0xdeadbeef),
1866  "got %d, expected ERROR_INVALID_WINDOW_HANDLE\n", GetLastError());
1867 
1868  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestInitDialogHandleProc, 0);
1869  ok(ret == IDOK, "Expected IDOK\n");
1870 
1871  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestDefButtonDlgProc, 0);
1872  ok(ret == IDOK, "Expected IDOK\n");
1873 
1874  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, TestReturnKeyDlgProc, 0);
1875  ok(ret == 0, "Unexpected ret value %ld.\n", ret);
1876 
1877  /* WM_SETTEXT handling in case of A/W dialog procedures vs A/W dialog window. */
1879  ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1880 
1881  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, test_aw_conversion_dlgproc2, 0);
1882  ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1883 
1885  ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1886 
1887  ret = DialogBoxParamA(GetModuleHandleA(NULL), "TEST_EMPTY_DIALOG", 0, test_aw_conversion_dlgproc3, 0);
1888  ok(ret == -123, "Unexpected ret value %ld.\n", ret);
1889 }
static INT_PTR CALLBACK DestroyOnCloseDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1266
#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:1352
static INT_PTR CALLBACK TestReturnKeyDlgProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1312
#define ERROR_RESOURCE_NAME_NOT_FOUND
Definition: winerror.h:1121
HANDLE HWND
Definition: compat.h:13
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
int32_t INT_PTR
Definition: typedefs.h:62
static INT_PTR CALLBACK test_aw_conversion_dlgproc3(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1780
smooth NULL
Definition: ftsmooth.c:416
LRESULT WINAPI DefDlgProcA(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1713
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:1284
#define SetLastError(x)
Definition: compat.h:417
int ret
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
#define broken(x)
Definition: _sntprintf.h:21
INT_PTR WINAPI DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
Definition: dialog.c:1895
static INT_PTR CALLBACK test_aw_conversion_dlgproc2(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1632
static INT_PTR CALLBACK test_aw_conversion_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: dialog.c:1524
#define ok(value,...)
Definition: atltest.h:57
static INT_PTR CALLBACK DestroyDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1255
static INT_PTR CALLBACK TestDefButtonDlgProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1300
#define WM_ERASEBKGND
Definition: winuser.h:1607
INT_PTR WINAPI DialogBoxParamW(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
Definition: dialog.c:1928

Referenced by START_TEST().

◆ test_DisabledDialogTest()

static void test_DisabledDialogTest ( void  )
static

Definition at line 1891 of file dialog.c.

1892 {
1893  g_terminated = FALSE;
1894  DialogBoxParamA(g_hinst, "IDD_DIALOG", NULL, disabled_test_proc, 0);
1895  ok(FALSE == g_terminated, "dialog with disabled ok button has been terminated\n");
1896 }
static LRESULT CALLBACK disabled_test_proc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:496
smooth NULL
Definition: ftsmooth.c:416
INT_PTR WINAPI DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
Definition: dialog.c:1895
#define ok(value,...)
Definition: atltest.h:57
static BOOL g_terminated
Definition: dialog.c:60
static HINSTANCE g_hinst
Definition: dialog.c:52

Referenced by START_TEST().

◆ test_focus()

static void test_focus ( void  )
static

Definition at line 958 of file dialog.c.

959 {
960  /* Test 1:
961  * This test intentionally returns FALSE in response to WM_INITDIALOG
962  * without setting focus to a control. This is what MFC's CFormView does.
963  *
964  * Since the WM_INITDIALOG handler returns FALSE without setting the focus,
965  * the focus should initially be NULL. Later, when we manually set focus to
966  * the dialog, the default handler should set focus to the first control that
967  * is "visible, not disabled, and has the WS_TABSTOP style" (MSDN). Because the
968  * second radio button has been checked, it should be the first control
969  * that meets these criteria and should receive the focus.
970  */
971 
973  g_hwndInitialFocusT1 = (HWND) -1;
974  g_hwndInitialFocusT2 = (HWND) -1;
977 
978  DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);
979 
980  ok (((g_styleInitialFocusT1 & WS_TABSTOP) == 0),
981  "Error in wrc - Detected WS_TABSTOP as default style for GROUPBOX\n");
982 
983  ok (((g_styleInitialFocusT2 & WS_VISIBLE) == 0),
984  "Modal dialogs should not be shown until the message queue first goes empty\n");
985 
987  "Error in initial focus when WM_INITDIALOG returned FALSE: "
988  "Expected NULL focus, got %s (%p).\n",
990 
992  "Error after first SetFocus() when WM_INITDIALOG returned FALSE: "
993  "Expected the second button (%p), got %s (%p).\n",
996 
997  /* Test 2:
998  * This is the same as above, except WM_INITDIALOG is made to return TRUE.
999  * This should cause the focus to go to the second radio button right away
1000  * and stay there (until the user indicates otherwise).
1001  */
1002 
1004  g_hwndInitialFocusT1 = (HWND) -1;
1005  g_hwndInitialFocusT2 = (HWND) -1;
1006  g_styleInitialFocusT1 = -1;
1007  g_styleInitialFocusT2 = -1;
1008 
1009  DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);
1010 
1012  "Error in initial focus when WM_INITDIALOG returned TRUE: "
1013  "Expected the second button (%p), got %s (%p).\n",
1016 
1018  "Error after first SetFocus() when WM_INITDIALOG returned TRUE: "
1019  "Expected the second button (%p), got %s (%p).\n",
1022 
1023  /* Test 3:
1024  * If the dialog has DS_CONTROL and it's not visible then we shouldn't change focus */
1025  {
1026  HWND hDlg;
1027  HRSRC hResource;
1028  HANDLE hTemplate;
1029  DLGTEMPLATE* pTemplate;
1030  HWND hTextbox;
1031  DWORD selectionStart = 0xdead, selectionEnd = 0xbeef;
1032 
1033  hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG", (LPCSTR)RT_DIALOG);
1034  hTemplate = LoadResource(g_hinst, hResource);
1035  pTemplate = LockResource(hTemplate);
1036 
1038  hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, focusDlgWinProc, 0);
1039  ok (hDlg != 0, "Failed to create test dialog.\n");
1040 
1041  ok ((g_hwndInitialFocusT1 == 0),
1042  "Focus should not be set for an invisible DS_CONTROL dialog %p.\n", g_hwndInitialFocusT1);
1043 
1044  /* Also make sure that WM_SETFOCUS selects the textbox's text */
1045  hTextbox = GetDlgItem(hDlg, 200);
1046  SendMessageA(hTextbox, WM_SETTEXT, 0, (LPARAM)"Hello world");
1047 
1048  SendMessageA(hDlg, WM_SETFOCUS, 0, 0);
1049  SendMessageA(hTextbox, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
1050  ok(selectionStart == 0 && selectionEnd == 11, "Text selection after WM_SETFOCUS is [%i, %i) expected [0, 11)\n", selectionStart, selectionEnd);
1051 
1052  /* but WM_ACTIVATE does not */
1053  SendMessageA(hTextbox, EM_SETSEL, 0, 0);
1054  SendMessageA(hDlg, WM_ACTIVATE, WA_ACTIVE, 0);
1055  SendMessageA(hTextbox, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
1056  ok(selectionStart == 0 && selectionEnd == 0, "Text selection after WM_ACTIVATE is [%i, %i) expected [0, 0)\n", selectionStart, selectionEnd);
1057 
1058  DestroyWindow(hDlg);
1059  }
1060 
1061  /* Test 4:
1062  * If the dialog has no tab-accessible controls, set focus to first control */
1063  {
1064  HWND hDlg;
1065  HRSRC hResource;
1066  HANDLE hTemplate;
1067  DLGTEMPLATE* pTemplate;
1068  HWND hLabel;
1069 
1070  hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_2", (LPCSTR)RT_DIALOG);
1071  hTemplate = LoadResource(g_hinst, hResource);
1072  pTemplate = LockResource(hTemplate);
1073 
1074  hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, focusDlgWinProc, 0);
1075  ok(hDlg != 0, "Failed to create test dialog.\n");
1076  hLabel = GetDlgItem(hDlg, 200);
1077 
1078  ok(GetFocus() == hLabel, "Focus not set to label, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1079 
1080  DestroyWindow(hDlg);
1081 
1082  /* Also check focus after WM_ACTIVATE and WM_SETFOCUS */
1083  hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, NULL, 0);
1084  ok(hDlg != 0, "Failed to create test dialog.\n");
1085  hLabel = GetDlgItem(hDlg, 200);
1086 
1087  SetFocus(NULL);
1088  SendMessageA(hDlg, WM_ACTIVATE, WA_ACTIVE, 0);
1089  ok(GetFocus() == NULL, "Focus set on WM_ACTIVATE, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1090 
1091  SetFocus(NULL);
1092  SendMessageA(hDlg, WM_SETFOCUS, 0, 0);
1093  ok(GetFocus() == hLabel, "Focus not set to label on WM_SETFOCUS, focus=%p dialog=%p label=%p\n", GetFocus(), hDlg, hLabel);
1094 
1095  DestroyWindow(hDlg);
1096  }
1097 
1098  /* Test 5:
1099  * Select textbox's text on creation */
1100  {
1101  HWND hDlg;
1102  HRSRC hResource;
1103  HANDLE hTemplate;
1104  DLGTEMPLATE* pTemplate;
1105  HWND edit;
1106  DWORD selectionStart = 0xdead, selectionEnd = 0xbeef;
1107 
1108  hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_3", (LPCSTR)RT_DIALOG);
1109  hTemplate = LoadResource(g_hinst, hResource);
1110  pTemplate = LockResource(hTemplate);
1111 
1112  hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, focusDlgWinProc, 0);
1113  ok(hDlg != 0, "Failed to create test dialog.\n");
1114  edit = GetDlgItem(hDlg, 200);
1115 
1116  ok(GetFocus() == edit, "Focus not set to edit, focus=%p, dialog=%p, edit=%p\n",
1117  GetFocus(), hDlg, edit);
1118  SendMessageA(edit, EM_GETSEL, (WPARAM)&selectionStart, (LPARAM)&selectionEnd);
1119  ok(selectionStart == 0 && selectionEnd == 11,
1120  "Text selection after WM_SETFOCUS is [%i, %i) expected [0, 11)\n",
1121  selectionStart, selectionEnd);
1122 
1123  DestroyWindow(hDlg);
1124  }
1125 
1126  /* Test 6:
1127  * Select textbox's text on creation when WM_INITDIALOG creates a child dialog. */
1128  {
1129  HWND hDlg;
1130  HRSRC hResource;
1131  HANDLE hTemplate;
1132  DLGTEMPLATE* pTemplate;
1133  HWND edit;
1134 
1135  hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG_3", (LPCSTR)RT_DIALOG);
1136  hTemplate = LoadResource(g_hinst, hResource);
1137  pTemplate = LockResource(hTemplate);
1138 
1140  ok(hDlg != 0, "Failed to create test dialog.\n");
1141  edit = GetDlgItem(hDlg, 200);
1142 
1143  ok(GetFocus() == edit, "Focus not set to edit, focus=%p, dialog=%p, edit=%p\n",
1144  GetFocus(), hDlg, edit);
1145 
1146  DestroyWindow(hDlg);
1147  }
1148 }
#define TRUE
Definition: types.h:120
static HWND g_hwndInitialFocusT2
Definition: dialog.c:55
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
HANDLE HWND
Definition: compat.h:13
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND WINAPI CreateDialogIndirectParamA(HINSTANCE hInstance, LPCDLGTEMPLATE lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit)
Definition: dialog.c:1639
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:868
static LONG g_styleInitialFocusT1
Definition: dialog.c:57
static INT_PTR CALLBACK delayFocusDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:828
#define EM_GETSEL
Definition: winuser.h:1979
static INT_PTR CALLBACK focusChildDlgWinProc(HWND hwnd, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:898
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
const char * LPCSTR
Definition: xmlstorage.h:183
#define WM_SETTEXT
Definition: winuser.h:1599
#define RT_DIALOG
Definition: pedump.c:367
#define WA_ACTIVE
Definition: winuser.h:2598
#define EM_SETSEL
Definition: winuser.h:2000
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WS_TABSTOP
Definition: pedump.c:634
#define WM_ACTIVATE
Definition: winuser.h:1594
#define ok(value,...)
Definition: atltest.h:57
HWND WINAPI GetFocus(void)
Definition: window.c:1905
HWND WINAPI GetDlgItem(HWND hDlg, int nIDDlgItem)
Definition: dialog.c:2183
#define WM_SETFOCUS
Definition: winuser.h:1595
#define WS_VISIBLE
Definition: pedump.c:620
static BOOL g_bInitialFocusInitDlgResult
Definition: dialog.c:58
static const char * GetHwndString(HWND hw)
Definition: dialog.c:940
static HINSTANCE g_hinst
Definition: dialog.c:52
static HWND g_hwndButton2
Definition: dialog.c:53
static LONG g_styleInitialFocusT2
Definition: dialog.c:57
static HWND g_hwndInitialFocusT1
Definition: dialog.c:55

Referenced by START_TEST().

◆ test_GetDlgItem()

static void test_GetDlgItem ( void  )
static

Definition at line 1200 of file dialog.c.

1201 {
1202  HWND hwnd, child1, child2, hwnd2;
1203  INT_PTR retval;
1204  BOOL ret;
1205 
1206  hwnd = CreateWindowA("button", "parent", WS_VISIBLE, 0, 0, 100, 100, NULL, 0, g_hinst, NULL);
1207  ok(hwnd != NULL, "failed to created window\n");
1208 
1209  /* created with the same ID */
1210  child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
1211  ok(child1 != NULL, "failed to create first child\n");
1212  child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
1213  ok(child2 != NULL, "failed to create second child\n");
1214 
1215  hwnd2 = GetDlgItem(hwnd, 0);
1216  ok(hwnd2 == child1, "expected first child, got %p\n", hwnd2);
1217 
1218  hwnd2 = GetTopWindow(hwnd);
1219  ok(hwnd2 == child1, "expected first child to be top, got %p\n", hwnd2);
1220 
1221  ret = SetWindowPos(child1, child2, 0, 0, 0, 0, SWP_NOMOVE);
1222  ok(ret, "got %d\n", ret);
1223  hwnd2 = GetTopWindow(hwnd);
1224  ok(hwnd2 == child2, "expected second child to be top, got %p\n", hwnd2);
1225 
1226  /* top window from child list is picked */
1227  hwnd2 = GetDlgItem(hwnd, 0);
1228  ok(hwnd2 == child2, "expected second child, got %p\n", hwnd2);
1229 
1230  /* Now test how GetDlgItem searches */
1231  DestroyWindow(child2);
1232  child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, child1, 0, g_hinst, NULL);
1233  ok(child2 != NULL, "failed to create second child\n");
1234 
1235  /* give child2 an ID */
1236  SetWindowLongA(child2, GWLP_ID, 100);
1237 
1238  hwnd2 = GetDlgItem(hwnd, 100);
1239  ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);
1240 
1241  /* make the ID of child2 public with a WS_EX_CONTROLPARENT parent */
1243 
1244  hwnd2 = GetDlgItem(hwnd, 100);
1245  ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);
1246 
1247  DestroyWindow(child1);
1248  DestroyWindow(child2);
1250 
1251  retval = DialogBoxParamA(g_hinst, "GETDLGITEM_TEST_DIALOG", NULL, getdlgitem_test_dialog_proc, 0);
1252  ok(retval == 0xdead, "Unexpected return value.\n");
1253 }
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:62
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:1163
int ret
INT_PTR WINAPI DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
Definition: dialog.c:1895
static HWND hwnd[MAXHWNDS]
Definition: dialog.c:48
#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:2183
#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:52
#define GWLP_ID
Definition: winuser.h:854

Referenced by START_TEST().

◆ test_GetDlgItemText()

static void test_GetDlgItemText ( void  )
static

Definition at line 1150 of file dialog.c.

1151 {
1152  char string[64];
1153  BOOL ret;
1154 
1155  strcpy(string, "Overwrite Me");
1156  ret = GetDlgItemTextA(NULL, 0, string, ARRAY_SIZE(string));
1157  ok(!ret, "GetDlgItemText(NULL) shouldn't have succeeded\n");
1158 
1159  ok(string[0] == '\0' || broken(!strcmp(string, "Overwrite Me")),
1160  "string retrieved using GetDlgItemText should have been NULL terminated\n");
1161 }
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:2247
#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 352 of file dialog.c.

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

Referenced by START_TEST().

◆ test_IsDialogMessage()

static void test_IsDialogMessage ( void  )
static

Definition at line 734 of file dialog.c.

735 {
736  HHOOK hook;
737  MSG msg;
738 
739  g_hwndMain = CreateWindowA("IsDialogMessageWindowClass", "IsDialogMessageWindowClass",
742  NULL, NULL, g_hinst, 0);
743 
744  assert (g_hwndMain);
747 
748  if (0)
749  {
750  /* crashes on Windows */
753  }
754 
755  /* The focus should initially be nowhere. The first TAB should take it
756  * to the first button. The second TAB should take it to the Cancel
757  * button.
758  */
759 
760  /* valid window, invalid message window */
762  FormTabMsg (&msg, (HWND)0xbeefbeef);
763  ok (!IsDialogMessageA(g_hwndMain, &msg), "expected failure\n");
764  ok(g_MSGF_DIALOGBOX, "hook wasn't called\n");
767 
770 
771  ok (!IsDialogMessageA(NULL, &msg), "expected failure\n");
772  ok (!IsDialogMessageA((HWND)0xbeefbeef, &msg), "expected failure\n");
773 
775 
776  ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle first TAB\n");
777  ok ((GetFocus() == g_hwndButton1), "Focus did not move to first button\n");
779  ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle second TAB\n");
781  "Focus did not move to cancel button\n");
783  ok (IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
784  ok (g_terminated, "ENTER did not terminate\n");
785 
786  /* matching but invalid window handles, NULL */
788 
789  FormTabMsg (&msg, NULL);
790  ok (!IsDialogMessageA(msg.hwnd, &msg), "expected failure\n");
791 
792  /* matching but invalid window handles, not NULL */
793  FormTabMsg (&msg, (HWND)0xbeefbeef);
794  ok (!IsDialogMessageA(msg.hwnd, &msg), "expected failure\n");
795 
798 
799  g_hwndMain = CreateWindowA("IsDialogMessageWindowClass", "IsDialogMessageWindowClass", WS_OVERLAPPEDWINDOW,
804  ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
805  ok(g_button1Clicked, "Did not receive button 1 click notification\n");
806 
809  ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
810  ok(g_button1Clicked, "Did not receive button 1 click notification\n");
811 
814  ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
815  ok(g_button1Clicked, "Did not receive button 1 click notification\n");
816 
817  /* Button with id larger than 0xFFFF should also work */
821  ok(IsDialogMessageA(g_hwndMain, &msg), "Did not handle the ENTER\n");
822  ok(g_button1Clicked, "Did not receive button 1 click notification\n");
823 
825 }
static HWND g_hwndButtonCancel
Definition: dialog.c:53
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:239
#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:61
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
static void FormTabMsg(MSG *pMsg, HWND hwnd)
Definition: dialog.c:228
Definition: msg.h:42
static LRESULT CALLBACK hook_proc2(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:727
static BOOL g_MSGF_DIALOGBOX
Definition: dialog.c:726
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define ok(value,...)
Definition: atltest.h:57
static HWND g_hwndMain
Definition: dialog.c:53
HWND WINAPI GetFocus(void)
Definition: window.c:1905
#define msg(x)
Definition: auth_time.c:54
static LRESULT CALLBACK hook_proc(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:720
static BOOL g_terminated
Definition: dialog.c:60
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define SetWindowLongPtrW
Definition: winuser.h:5321
static HWND g_hwndButton1
Definition: dialog.c:53
static HINSTANCE g_hinst
Definition: dialog.c:52
static HWND g_hwndButton2
Definition: dialog.c:53
#define GWLP_ID
Definition: winuser.h:854

Referenced by START_TEST().

◆ test_MessageBox()

static void test_MessageBox ( void  )
static

Definition at line 2383 of file dialog.c.

2384 {
2385  static const struct
2386  {
2387  DWORD mb_style;
2388  DWORD ex_style;
2389  } test[] =
2390  {
2391  { MB_OK, 0 },
2392  { MB_OK | MB_TASKMODAL, 0 },
2394  };
2396  HANDLE thread;
2397  DWORD tid, i;
2398  HHOOK hook;
2399  int ret;
2400 
2402 
2403  ret = MessageBoxA(NULL, "Text", "MSGBOX caption", MB_OKCANCEL);
2404  ok(ret == IDCANCEL, "got %d\n", ret);
2405 
2407 
2408  sprintf(params.caption, "pid %08x, tid %08x, time %08x",
2410 
2411  params.owner = FALSE;
2412 
2413  for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
2414  {
2415  HWND hwnd;
2416  DWORD ex_style;
2417 
2418  params.style = test[i].mb_style;
2419 
2421 
2422  hwnd = wait_for_window(params.caption);
2423  ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
2424  ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style);
2425 
2427 
2428  ok(WaitForSingleObject(thread, 5000) != WAIT_TIMEOUT, "thread failed to terminate\n");
2430  }
2431 
2432  params.owner = TRUE;
2433 
2434  for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
2435  {
2436  HWND hwnd;
2437  DWORD ex_style;
2438 
2439  params.style = test[i].mb_style;
2440 
2442 
2443  hwnd = wait_for_window(params.caption);
2444  ex_style = GetWindowLongA(hwnd, GWL_EXSTYLE);
2445  ok((ex_style & WS_EX_TOPMOST) == test[i].ex_style, "%d: got window ex_style %#x\n", i, ex_style);
2446 
2448 
2449  ok(WaitForSingleObject(thread, 5000) != WAIT_TIMEOUT, "thread failed to terminate\n");
2451  }
2452 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
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:2056
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)
GLenum const GLfloat * params
Definition: glext.h:5645
#define MB_TASKMODAL
Definition: winuser.h:810
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
smooth NULL
Definition: ftsmooth.c:416
#define MB_OKCANCEL
Definition: winuser.h:798
#define WH_CBT
Definition: winuser.h:35
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
Definition: msg.h:42
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WAIT_TIMEOUT
Definition: dderror.h:14
static DWORD WINAPI create_window_thread(void *param)
Definition: dialog.c:2342
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:48
#define ok(value,...)
Definition: atltest.h:57
static HWND wait_for_window(const char *caption)
Definition: dialog.c:2360
static LRESULT CALLBACK msgbox_hook_proc(INT code, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:2307
#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 2148 of file dialog.c.

2149 {
2150  DWORD tid = 0;
2151 
2153  trace("non_english %d\n", non_english);
2154 
2156  MessageBoxA(NULL, "Message", msgbox_title, MB_OK);
2157 
2159  MessageBoxA(NULL, "Message", msgbox_title, MB_OKCANCEL);
2160 
2163 
2165  MessageBoxA(NULL, "Message", msgbox_title, MB_YESNO);
2166 
2169 
2172 
2175 }
static WCHAR expectedAbortRetryIgnore[]
Definition: dialog.c:2021
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:2085
#define MB_YESNOCANCEL
Definition: winuser.h:812
#define MB_OKCANCEL
Definition: winuser.h:798
BOOL non_english
Definition: dialog.c:2083
#define trace
Definition: atltest.h:70
static WCHAR expectedOkCancel[]
Definition: dialog.c:2009
static WCHAR expectedRetryCancel[]
Definition: dialog.c:2058
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LANG_ENGLISH
Definition: nls.h:52
static const char msgbox_title[]
Definition: dialog.c:1996
static WCHAR expectedCancelTryContinue[]
Definition: dialog.c:2070
#define MB_ABORTRETRYIGNORE
Definition: winuser.h:785
static WCHAR expectedOK[]
Definition: dialog.c:1997
#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:2046
static WCHAR expectedYesNo[]
Definition: dialog.c:2034
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by START_TEST().

◆ test_MessageBoxFontTest()

static void test_MessageBoxFontTest ( void  )
static

Definition at line 1909 of file dialog.c.

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

Referenced by START_TEST().

◆ test_SaveRestoreFocus()

static void test_SaveRestoreFocus ( void  )
static

Definition at line 2177 of file dialog.c.

2178 {
2179  HWND hDlg;
2180  HRSRC hResource;
2181  HANDLE hTemplate;
2182  DLGTEMPLATE* pTemplate;
2183  LONG_PTR foundId;
2184  HWND foundHwnd;
2185 
2186  /* create the dialog */
2187  hResource = FindResourceA(g_hinst, "MULTI_EDIT_DIALOG", (LPCSTR)RT_DIALOG);
2188  hTemplate = LoadResource(g_hinst, hResource);
2189  pTemplate = LockResource(hTemplate);
2190 
2192  ok (hDlg != 0, "Failed to create test dialog.\n");
2193 
2194  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2195  ok (foundId == 1000, "First edit box should have gained focus on dialog creation. Expected: %d, Found: %ld\n", 1000, foundId);
2196 
2199  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2200  ok (foundId == 1001, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);
2202 
2203  /* de- then reactivate the dialog */
2206 
2207  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2208  ok (foundId == 1000, "First edit box should have regained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1000, foundId);
2209 
2210  /* select the next tabbable item */
2212 
2213  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2214  ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
2215 
2216  /* de- then reactivate the dialog */
2219 
2220  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2221  ok (foundId == 1001, "Second edit box should have gained focus after dialog reactivation. Expected: %d, Found: %ld\n", 1001, foundId);
2222 
2223  /* set focus to the dialog */
2224  SetFocus(hDlg);
2225 
2226  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2227  ok (foundId == 1000, "First edit box should have gained focus on dialog focus. Expected: %d, Found: %ld\n", 1000, foundId);
2228 
2229  /* select second tabbable item */
2231 
2232  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2233  ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
2234 
2235  /* send WM_ACTIVATE message to already active dialog */
2237 
2238  foundId = GetWindowLongPtrA(GetFocus(), GWLP_ID);
2239  ok (foundId == 1001, "Second edit box should have gained focus. Expected: %d, Found: %ld\n", 1001, foundId);
2240 
2241  /* disable the 2nd box */
2243 
2244  foundHwnd = GetFocus();
2245  ok (foundHwnd == NULL, "Second edit box should have lost focus after being disabled. Expected: %p, Found: %p\n", NULL, foundHwnd);
2246 
2247  /* de- then reactivate the dialog */
2250 
2251  foundHwnd = GetFocus();
2252  ok (foundHwnd == NULL, "No controls should have gained focus after dialog reactivation. Expected: %p, Found: %p\n", NULL, foundHwnd);
2253 
2254  /* clean up */
2255  DestroyWindow(hDlg);
2256 }
HWND WINAPI GetNextDlgTabItem(HWND hDlg, HWND hCtl, BOOL bPrevious)
Definition: dialog.c:2400
#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:1639
BOOL WINAPI DestroyWindow(_In_ HWND)
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define RT_DIALOG
Definition: pedump.c:367
#define GetWindowLongPtrA
Definition: winuser.h: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:1905
#define WA_INACTIVE
Definition: winuser.h:2597
static HINSTANCE g_hinst
Definition: dialog.c:52
#define GWLP_ID
Definition: winuser.h:854
static INT_PTR CALLBACK messageBoxFontDlgWinProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
Definition: dialog.c:1898

Referenced by START_TEST().

◆ test_timer_message()

static void test_timer_message ( void  )
static

Definition at line 2302 of file dialog.c.

2303 {
2304  DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, timer_message_dlg_proc);
2305 }
#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:2258
static HINSTANCE g_hinst
Definition: dialog.c:52

Referenced by START_TEST().

◆ test_WM_NEXTDLGCTL()

static void test_WM_NEXTDLGCTL ( void  )
static

Definition at line 608 of file dialog.c.

609 {
610  HWND child1, child2, child3;
611  MSG msg;
612  DWORD dwVal;
613 
616  "WM_NEXTDLGCTLWndClass",
617  "WM_NEXTDLGCTL Message test window",
620  0, 0, 235, 135,
621  NULL, NULL, g_hinst, 0);
622 
627 
628  /*
629  * Test message DM_SETDEFID
630  */
631 
634  dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
635 
636  ok ( IDCANCEL == (LOWORD(dwVal)), "Did not set default ID\n" );
637 
638  /*
639  * Check whether message WM_NEXTDLGCTL is changing the focus to next control and if
640  * the destination control is a button, style of the button should be changed to
641  * BS_DEFPUSHBUTTON with out making it default.
642  */
643 
644  /* Keep the focus on Edit control. */
646  ok((GetFocus() == g_hwndTestDlgEdit), "Focus didn't set on Edit control\n");
647 
648  /* Test message WM_NEXTDLGCTL */
650  ok((GetFocus() == g_hwndTestDlgBut1), "Focus didn't move to first button\n");
651 
652  /* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL" */
653  dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
654  ok(IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
655 
656  /*
657  * Check whether the style of the button which got the focus, changed to BS_DEFPUSHBUTTON and
658  * the style of default button changed to BS_PUSHBUTTON.
659  */
660  ok(get_button_style(g_hwndTestDlgBut1) == BS_DEFPUSHBUTTON, "Button1's style not set to BS_DEFPUSHBUTTON");
661  ok(get_button_style(g_hwndTestDlgBut2) == BS_PUSHBUTTON, "Button2's style not set to BS_PUSHBUTTON");
662 
663  /* Move focus to Button2 using "WM_NEXTDLGCTL" */
665  ok((GetFocus() == g_hwndTestDlgBut2), "Focus didn't move to second button\n");
666 
667  /* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL" */
668  dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
669  ok(IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
670 
671  /*
672  * Check whether the style of the button which got the focus, changed to BS_DEFPUSHBUTTON and
673  * the style of button which lost the focus changed to BS_PUSHBUTTON.
674  */
675  ok(get_button_style(g_hwndTestDlgBut1) == BS_PUSHBUTTON, "Button1's style not set to BS_PUSHBUTTON");
676  ok(get_button_style(g_hwndTestDlgBut2) == BS_DEFPUSHBUTTON, "Button2's style not set to BS_DEFPUSHBUTTON");
677 
678  /* Move focus to Edit control using "WM_NEXTDLGCTL" */
680  ok((GetFocus() == g_hwndTestDlgEdit), "Focus didn't move to Edit control\n");
681 
682  /* Check whether the default button ID got changed by sending message "WM_NEXTDLGCTL" */
683  dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
684  ok(IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
685 
686  /* test nested default buttons */
687 
688  child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 50, 50,
689  g_hwndTestDlg, (HMENU)100, g_hinst, NULL);
690  ok(child1 != NULL, "failed to create first child\n");
691  child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 60, 60, 30, 30,
692  g_hwndTestDlg, (HMENU)200, g_hinst, NULL);
693  ok(child2 != NULL, "failed to create second child\n");
694  /* create nested child */
695  child3 = CreateWindowA("button", "child3", WS_VISIBLE|WS_CHILD, 10, 10, 10, 10,
696  child1, (HMENU)300, g_hinst, NULL);
697  ok(child3 != NULL, "failed to create subchild\n");
698 
700  dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
701  ok(LOWORD(dwVal) == 200, "expected 200, got %x\n", dwVal);
702 
704  dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
705  ok(LOWORD(dwVal) == 300, "expected 300, got %x\n", dwVal);
706  ok(SendMessageW( child3, WM_GETDLGCODE, 0, 0) != DLGC_DEFPUSHBUTTON,
707  "expected child3 not to be marked as DLGC_DEFPUSHBUTTON\n");
708 
710  FormEnterMsg (&msg, child3);
711  ok(IsDialogMessageA(g_hwndTestDlg, &msg), "Did not handle the ENTER\n");
712  ok(g_bReceivedCommand, "Did not trigger the default Button action\n");
713 
714  DestroyWindow(child3);
715  DestroyWindow(child2);
716  DestroyWindow(child1);
718 }
static HWND g_hwndTestDlg
Definition: dialog.c:54
#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:54
#define WM_GETDLGCODE
Definition: winuser.h:1671
#define WM_NEXTDLGCTL
Definition: winuser.h:1625
static HWND g_hwndTestDlgBut2
Definition: dialog.c:54
#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:154
#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:239
#define WS_EX_CONTROLPARENT
Definition: winuser.h:387
static BOOL g_bReceivedCommand
Definition: dialog.c:58
#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:1713
static HWND g_hwndTestDlgEdit
Definition: dialog.c:54
#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:1905
#define msg(x)
Definition: auth_time.c:54
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define IDCANCEL
Definition: winuser.h:825
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define LOWORD(l)
Definition: pedump.c:82
static HINSTANCE g_hinst
Definition: dialog.c:52

Referenced by START_TEST().

◆ TestControlStyleDlgProc()

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

Definition at line 1352 of file dialog.c.

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

1302 {
1303  switch (uiMsg)
1304  {
1305  case WM_INITDIALOG:
1306  EndDialog(hDlg, LOWORD(SendMessageA(hDlg, DM_GETDEFID, 0, 0)));
1307  return TRUE;
1308  }
1309  return FALSE;
1310 }
#define TRUE
Definition: types.h:120
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DM_GETDEFID
Definition: winuser.h:2080
BOOL WINAPI EndDialog(HWND hwnd, INT_PTR retval)
Definition: dialog.c:2085
#define WM_INITDIALOG
Definition: winuser.h:1721