ReactOS 0.4.17-dev-672-gf9943c7
dialog.c File Reference
#include <user32.h>
Include dependency graph for dialog.c:

Go to the source code of this file.

Classes

struct  DIALOGINFO
 
struct  DLG_CONTROL_INFO
 
struct  DLG_TEMPLATE
 
struct  RADIOGROUP
 

Macros

#define DF_END   0x0001
 
#define DF_DIALOGACTIVE   0x4000
 
#define GETDLGINFO(hwnd)   DIALOG_get_info(hwnd, FALSE)
 
#define GET_WORD(ptr)   (*(WORD *)(ptr))
 
#define GET_DWORD(ptr)   (*(DWORD *)(ptr))
 
#define GET_LONG(ptr)   (*(const LONG *)(ptr))
 
#define DLG_ISANSI   2
 
#define SENDMSG(msg, wparam, lparam)
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
DIALOGINFODIALOG_get_info (HWND hWnd, BOOL create)
 
static const WORDDIALOG_GetControl32 (const WORD *p, DLG_CONTROL_INFO *info, BOOL dialogEx)
 
static BOOL DIALOG_CreateControls32 (HWND hwnd, LPCSTR template, const DLG_TEMPLATE *dlgTemplate, HINSTANCE hInst, BOOL unicode)
 
static BOOL DIALOG_IsAccelerator (HWND hwnd, HWND hwndDlg, WPARAM wParam)
 
static HWND DIALOG_FindMsgDestination (HWND hwndDlg)
 
INT DIALOG_DoDialogBox (HWND hwnd, HWND owner)
 
static LPCSTR DIALOG_ParseTemplate32 (LPCSTR template, DLG_TEMPLATE *result)
 
static void DEFDLG_SetFocus (HWND hwndCtrl)
 
static void DEFDLG_SaveFocus (HWND hwnd)
 
static void DEFDLG_RestoreFocus (HWND hwnd, BOOL justActivate)
 
static HWND DIALOG_CreateIndirect (HINSTANCE hInst, LPCVOID dlgTemplate, HWND owner, DLGPROC dlgProc, LPARAM param, BOOL unicode, HWND *modal_owner)
 
static HWND DEFDLG_FindDefButton (HWND hwndDlg)
 
static BOOL DEFDLG_SetDefId (HWND hwndDlg, DIALOGINFO *dlgInfo, WPARAM wParam)
 
static BOOL DEFDLG_SetDefButton (HWND hwndDlg, DIALOGINFO *dlgInfo, HWND hwndNew)
 
static LRESULT DEFDLG_Proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, DIALOGINFO *dlgInfo)
 
static LRESULT DEFDLG_Epilog (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL fResult, BOOL fAnsi)
 
static HWND DIALOG_GetNextTabItem (HWND hwndMain, HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious)
 
static INT DIALOG_DlgDirListW (HWND hDlg, LPWSTR spec, INT idLBox, INT idStatic, UINT attrib, BOOL combo)
 
static INT DIALOG_DlgDirListA (HWND hDlg, LPSTR spec, INT idLBox, INT idStatic, UINT attrib, BOOL combo)
 
static BOOL DIALOG_DlgDirSelect (HWND hwnd, LPWSTR str, INT len, INT id, BOOL unicode, BOOL combo)
 
HWND WINAPI CreateDialogIndirectParamAorW (HINSTANCE hInstance, LPCDLGTEMPLATE lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit, DWORD Flags)
 
HWND WINAPI CreateDialogIndirectParamA (HINSTANCE hInstance, LPCDLGTEMPLATE lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit)
 
HWND WINAPI CreateDialogIndirectParamW (HINSTANCE hInstance, LPCDLGTEMPLATE lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit)
 
HWND WINAPI CreateDialogParamA (HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
 
HWND WINAPI CreateDialogParamW (HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
 
LRESULT WINAPI DefDlgProcA (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI DefDlgProcW (HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
 
INT_PTR WINAPI DialogBoxIndirectParamAorW (HINSTANCE hInstance, LPCDLGTEMPLATE hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam, DWORD Flags)
 
INT_PTR WINAPI DialogBoxIndirectParamA (HINSTANCE hInstance, LPCDLGTEMPLATE hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
 
INT_PTR WINAPI DialogBoxIndirectParamW (HINSTANCE hInstance, LPCDLGTEMPLATE hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
 
INT_PTR WINAPI DialogBoxParamA (HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
 
INT_PTR WINAPI DialogBoxParamW (HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
 
int WINAPI DlgDirListA (HWND hDlg, LPSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT uFileType)
 
int WINAPI DlgDirListComboBoxA (HWND hDlg, LPSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT uFiletype)
 
int WINAPI DlgDirListComboBoxW (HWND hDlg, LPWSTR lpPathSpec, int nIDComboBox, int nIDStaticPath, UINT uFiletype)
 
int WINAPI DlgDirListW (HWND hDlg, LPWSTR lpPathSpec, int nIDListBox, int nIDStaticPath, UINT uFileType)
 
BOOL WINAPI DlgDirSelectComboBoxExA (HWND hDlg, LPSTR lpString, int nCount, int nIDComboBox)
 
BOOL WINAPI DlgDirSelectComboBoxExW (HWND hDlg, LPWSTR lpString, int nCount, int nIDComboBox)
 
BOOL WINAPI DlgDirSelectExA (HWND hDlg, LPSTR lpString, int nCount, int nIDListBox)
 
BOOL WINAPI DlgDirSelectExW (HWND hDlg, LPWSTR lpString, int nCount, int nIDListBox)
 
BOOL WINAPI EndDialog (HWND hwnd, INT_PTR retval)
 
LONG WINAPI GetDialogBaseUnits (VOID)
 
int WINAPI GetDlgCtrlID (HWND hwndCtl)
 
HWND WINAPI GetDlgItem (HWND hDlg, int nIDDlgItem)
 
UINT WINAPI GetDlgItemInt (HWND hDlg, int nIDDlgItem, BOOL *lpTranslated, BOOL bSigned)
 
UINT WINAPI GetDlgItemTextA (HWND hDlg, int nIDDlgItem, LPSTR lpString, int nMaxCount)
 
UINT WINAPI GetDlgItemTextW (HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
 
HWND WINAPI GetNextDlgGroupItem (HWND hDlg, HWND hCtl, BOOL bPrevious)
 
HWND WINAPI GetNextDlgTabItem (HWND hDlg, HWND hCtl, BOOL bPrevious)
 
static BOOL CALLBACK DIALOG_FixOneChildOnChangeFocus (HWND hwndChild, LPARAM lParam)
 
static void DIALOG_FixChildrenOnChangeFocus (HWND hwndDlg, HWND hwndNext)
 
static HWND DIALOG_IdToHwnd (HWND hwndDlg, INT id)
 
BOOL WINAPI IsDialogMessageW (HWND hDlg, LPMSG lpMsg)
 
UINT WINAPI IsDlgButtonChecked (HWND hDlg, int nIDButton)
 
BOOL WINAPI MapDialogRect (HWND hDlg, LPRECT lpRect)
 
LRESULT WINAPI SendDlgItemMessageA (HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam)
 
LRESULT WINAPI SendDlgItemMessageW (HWND hDlg, int nIDDlgItem, UINT Msg, WPARAM wParam, LPARAM lParam)
 
BOOL WINAPI SetDlgItemInt (HWND hDlg, int nIDDlgItem, UINT uValue, BOOL bSigned)
 
BOOL WINAPI SetDlgItemTextA (HWND hDlg, int nIDDlgItem, LPCSTR lpString)
 
BOOL WINAPI SetDlgItemTextW (HWND hDlg, int nIDDlgItem, LPCWSTR lpString)
 
BOOL WINAPI CheckDlgButton (HWND hDlg, int nIDButton, UINT uCheck)
 
static BOOL CALLBACK CheckRB (HWND hwnd, LPARAM lParam)
 
BOOL WINAPI CheckRadioButton (HWND hDlg, int nIDFirstButton, int nIDLastButton, int nIDCheckButton)
 

Variables

const struct builtin_class_descr DIALOG_builtin_class
 

Macro Definition Documentation

◆ DF_DIALOGACTIVE

#define DF_DIALOGACTIVE   0x4000

Definition at line 38 of file dialog.c.

◆ DF_END

#define DF_END   0x0001

Definition at line 37 of file dialog.c.

◆ DLG_ISANSI

#define DLG_ISANSI   2

Definition at line 43 of file dialog.c.

◆ GET_DWORD

#define GET_DWORD (   ptr)    (*(DWORD *)(ptr))

Definition at line 41 of file dialog.c.

◆ GET_LONG

#define GET_LONG (   ptr)    (*(const LONG *)(ptr))

Definition at line 42 of file dialog.c.

◆ GET_WORD

#define GET_WORD (   ptr)    (*(WORD *)(ptr))

Definition at line 40 of file dialog.c.

◆ GETDLGINFO

#define GETDLGINFO (   hwnd)    DIALOG_get_info(hwnd, FALSE)

Definition at line 39 of file dialog.c.

◆ SENDMSG

#define SENDMSG (   msg,
  wparam,
  lparam 
)
Value:
@ lparam
Definition: SystemMenu.c:31
@ wparam
Definition: SystemMenu.c:30
#define msg(x)
Definition: auth_time.c:54
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define DDL_POSTMSGS
Definition: winuser.h:424
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Function Documentation

◆ CheckDlgButton()

BOOL WINAPI CheckDlgButton ( HWND  hDlg,
int  nIDButton,
UINT  uCheck 
)

Definition at line 2865 of file dialog.c.

2869{
2870 SendDlgItemMessageW( hDlg, nIDButton, BM_SETCHECK, uCheck, 0 );
2871 return TRUE;
2872}
#define TRUE
Definition: types.h:120
#define BM_SETCHECK
Definition: winuser.h:1950
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ CheckRadioButton()

BOOL WINAPI CheckRadioButton ( HWND  hDlg,
int  nIDFirstButton,
int  nIDLastButton,
int  nIDCheckButton 
)

Definition at line 2900 of file dialog.c.

2905{
2906 RADIOGROUP radioGroup;
2907
2908 radioGroup.firstID = nIDFirstButton;
2909 radioGroup.lastID = nIDLastButton;
2910 radioGroup.checkID = nIDCheckButton;
2911
2912 return EnumChildWindows(hDlg, CheckRB, (LPARAM)&radioGroup);
2913}
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT checkID
Definition: dialog.c:102
UINT lastID
Definition: dialog.c:101
UINT firstID
Definition: dialog.c:100
static BOOL CALLBACK CheckRB(HWND hwnd, LPARAM lParam)
Definition: dialog.c:2874
BOOL WINAPI EnumChildWindows(_In_opt_ HWND, _In_ WNDENUMPROC, _In_ LPARAM)

◆ CheckRB()

static BOOL CALLBACK CheckRB ( HWND  hwnd,
LPARAM  lParam 
)
static

Definition at line 2874 of file dialog.c.

2875{
2876 LONG lChildID = GetWindowLongPtrW(hwnd, GWLP_ID);
2877 RADIOGROUP *lpRadioGroup = (RADIOGROUP *)lParam;
2878
2879 if((lChildID >= lpRadioGroup->firstID) &&
2880 (lChildID <= lpRadioGroup->lastID))
2881 {
2882 if (lChildID == lpRadioGroup->checkID)
2883 {
2885 }
2886 else
2887 {
2889 }
2890 }
2891
2892 return TRUE;
2893}
LPARAM lParam
Definition: combotst.c:139
long LONG
Definition: pedump.c:60
#define GetWindowLongPtrW
Definition: winuser.h:4983
#define BST_UNCHECKED
Definition: winuser.h:199
#define GWLP_ID
Definition: winuser.h:871
#define BST_CHECKED
Definition: winuser.h:197

Referenced by CheckRadioButton().

◆ CreateDialogIndirectParamA()

HWND WINAPI CreateDialogIndirectParamA ( HINSTANCE  hInstance,
LPCDLGTEMPLATE  lpTemplate,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit 
)

Definition at line 1657 of file dialog.c.

1663{
1664 return CreateDialogIndirectParamAorW( hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit, DLG_ISANSI);
1665}
HINSTANCE hInstance
Definition: charmap.c:19
HWND WINAPI CreateDialogIndirectParamAorW(HINSTANCE hInstance, LPCDLGTEMPLATE lpTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM lParamInit, DWORD Flags)
Definition: dialog.c:1635
#define DLG_ISANSI
Definition: dialog.c:43

◆ CreateDialogIndirectParamAorW()

HWND WINAPI CreateDialogIndirectParamAorW ( HINSTANCE  hInstance,
LPCDLGTEMPLATE  lpTemplate,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit,
DWORD  Flags 
)

Definition at line 1635 of file dialog.c.

1642{
1643/* FIXME:
1644 * This function might be obsolete since I don't think it is exported by NT
1645 * Also wine has one more parameter identifying weather it should call
1646 * the function with unicode or not
1647 */
1648 return DIALOG_CreateIndirect( hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit , Flags == DLG_ISANSI ? FALSE : TRUE, NULL );
1649}
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
static HWND DIALOG_CreateIndirect(HINSTANCE hInst, LPCVOID dlgTemplate, HWND owner, DLGPROC dlgProc, LPARAM param, BOOL unicode, HWND *modal_owner)
Definition: dialog.c:765
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170

Referenced by CreateDialogIndirectParamA(), and CreateDialogIndirectParamW().

◆ CreateDialogIndirectParamW()

HWND WINAPI CreateDialogIndirectParamW ( HINSTANCE  hInstance,
LPCDLGTEMPLATE  lpTemplate,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  lParamInit 
)

Definition at line 1673 of file dialog.c.

1679{
1680 return CreateDialogIndirectParamAorW( hInstance, lpTemplate, hWndParent, lpDialogFunc, lParamInit, 0);
1681}

◆ CreateDialogParamA()

HWND WINAPI CreateDialogParamA ( HINSTANCE  hInstance,
LPCSTR  lpTemplateName,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  dwInitParam 
)

Definition at line 1689 of file dialog.c.

1695{
1696 HRSRC hrsrc;
1698
1699 if (!(hrsrc = FindResourceA( hInstance, lpTemplateName, (LPCSTR)RT_DIALOG ))) return 0;
1700 if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0;
1701 return CreateDialogIndirectParamA( hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam );
1702}
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
static PVOID ptr
Definition: dispmode.c:27
#define RT_DIALOG
Definition: pedump.c:367
const char * LPCSTR
Definition: typedefs.h:52
HWND WINAPI CreateDialogIndirectParamA(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

◆ CreateDialogParamW()

HWND WINAPI CreateDialogParamW ( HINSTANCE  hInstance,
LPCWSTR  lpTemplateName,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  dwInitParam 
)

Definition at line 1710 of file dialog.c.

1716{
1717 HRSRC hrsrc;
1719
1720 if (!(hrsrc = FindResourceW( hInstance, lpTemplateName, (LPCWSTR)RT_DIALOG ))) return 0;
1721 if (!(ptr = (LPCDLGTEMPLATE)LoadResource(hInstance, hrsrc))) return 0;
1722 return CreateDialogIndirectParamW( hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam );
1723}
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
const uint16_t * LPCWSTR
Definition: typedefs.h:57
HWND WINAPI CreateDialogIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)

◆ DEFDLG_Epilog()

static LRESULT DEFDLG_Epilog ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  fResult,
BOOL  fAnsi 
)
static

Definition at line 1364 of file dialog.c.

1365{
1366 if ((msg >= WM_CTLCOLORMSGBOX && msg <= WM_CTLCOLORSTATIC) ||
1367 msg == WM_CTLCOLOR)
1368 {
1369 if (fResult) return fResult;
1370
1371 return fAnsi ? DefWindowProcA(hwnd, msg, wParam, lParam):
1373 }
1374 if ( msg == WM_COMPAREITEM ||
1377 return fResult;
1378
1380}
WPARAM wParam
Definition: combotst.c:138
#define WM_CTLCOLOR
Definition: windowsx.h:29
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1800
#define WM_CHARTOITEM
Definition: winuser.h:1677
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_INITDIALOG
Definition: winuser.h:1767
#define WM_QUERYDRAGICON
Definition: winuser.h:1682
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1794
#define DWLP_MSGRESULT
Definition: winuser.h:881
#define WM_COMPAREITEM
Definition: winuser.h:1683
#define WM_VKEYTOITEM
Definition: winuser.h:1676

Referenced by DefDlgProcA(), and DefDlgProcW().

◆ DEFDLG_FindDefButton()

static HWND DEFDLG_FindDefButton ( HWND  hwndDlg)
static

Definition at line 1105 of file dialog.c.

1106{
1107 HWND hwndChild, hwndTmp;
1108
1109 hwndChild = GetWindow( hwndDlg, GW_CHILD );
1110 while (hwndChild)
1111 {
1112 if (SendMessageW( hwndChild, WM_GETDLGCODE, 0, 0 ) & DLGC_DEFPUSHBUTTON)
1113 break;
1114
1115 /* Recurse into WS_EX_CONTROLPARENT controls */
1117 {
1118 LONG dsStyle = GetWindowLongPtrW( hwndChild, GWL_STYLE );
1119 if ((dsStyle & WS_VISIBLE) && !(dsStyle & WS_DISABLED) &&
1120 (hwndTmp = DEFDLG_FindDefButton(hwndChild)) != NULL)
1121 return hwndTmp;
1122 }
1123 hwndChild = GetWindow( hwndChild, GW_HWNDNEXT );
1124 }
1125 return hwndChild;
1126}
#define WS_VISIBLE
Definition: pedump.c:620
#define WS_DISABLED
Definition: pedump.c:621
static HWND DEFDLG_FindDefButton(HWND hwndDlg)
Definition: dialog.c:1105
#define WS_EX_CONTROLPARENT
Definition: winuser.h:387
#define DLGC_DEFPUSHBUTTON
Definition: winuser.h:2657
#define GW_HWNDNEXT
Definition: winuser.h:772
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define GW_CHILD
Definition: winuser.h:774
#define GWL_STYLE
Definition: winuser.h:863
#define WM_GETDLGCODE
Definition: winuser.h:1717
#define GWL_EXSTYLE
Definition: winuser.h:862

Referenced by DEFDLG_FindDefButton(), DEFDLG_Proc(), DEFDLG_SetDefButton(), and DEFDLG_SetDefId().

◆ DEFDLG_Proc()

static LRESULT DEFDLG_Proc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam,
DIALOGINFO dlgInfo 
)
static

Definition at line 1252 of file dialog.c.

1254{
1255 switch(msg)
1256 {
1257 case WM_ERASEBKGND:
1258 {
1259 HBRUSH brush = GetControlColor( hwnd, hwnd, (HDC)wParam, WM_CTLCOLORDLG);
1260 if (brush)
1261 {
1262 RECT rect;
1263 HDC hdc = (HDC)wParam;
1264 GetClientRect( hwnd, &rect );
1265 DPtoLP( hdc, (LPPOINT)&rect, 2 );
1266 FillRect( hdc, &rect, brush );
1267 }
1268 return 1;
1269 }
1270 case WM_NCDESTROY:
1272 dlgInfo = DIALOG_get_info(hwnd, FALSE);
1273 if (dlgInfo != NULL)
1274 {
1275 if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
1276 if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
1277 HeapFree( GetProcessHeap(), 0, dlgInfo );
1280 }
1281 /* Window clean-up */
1282 return DefWindowProcA( hwnd, msg, wParam, lParam );
1283
1284 case WM_SHOWWINDOW:
1285 if (!wParam) DEFDLG_SaveFocus( hwnd );
1286 return DefWindowProcA( hwnd, msg, wParam, lParam );
1287
1288 case WM_ACTIVATE:
1289 { // ReactOS
1290 DWORD dwSetFlag;
1292 // if WA_CLICK/ACTIVE ? set dialog is active.
1293 dwSetFlag = wParam ? DF_DIALOGACTIVE : 0;
1295 }
1297 else DEFDLG_SaveFocus( hwnd );
1298 return 0;
1299
1300 case WM_SETFOCUS:
1302 return 0;
1303
1304 case DM_SETDEFID:
1305 if (dlgInfo && !(dlgInfo->flags & DF_END))
1306 DEFDLG_SetDefId( hwnd, dlgInfo, wParam );
1307 return 1;
1308
1309 case DM_GETDEFID:
1310 if (dlgInfo && !(dlgInfo->flags & DF_END))
1311 {
1312 HWND hwndDefId;
1313 if (dlgInfo->idResult)
1314 return MAKELONG( dlgInfo->idResult, DC_HASDEFID );
1315 if ((hwndDefId = DEFDLG_FindDefButton( hwnd )))
1316 return MAKELONG( GetDlgCtrlID( hwndDefId ), DC_HASDEFID);
1317 }
1318 return 0;
1319
1320#ifdef __REACTOS__
1321 case DM_REPOSITION:
1322 DEFDLG_Reposition(hwnd);
1323 return 0;
1324#endif
1325 case WM_NEXTDLGCTL:
1326 if (dlgInfo)
1327 {
1328 HWND hwndDest = (HWND)wParam;
1329 if (!lParam)
1330 hwndDest = GetNextDlgTabItem(hwnd, GetFocus(), wParam);
1331 if (hwndDest) DEFDLG_SetFocus( hwndDest );
1332 DEFDLG_SetDefButton( hwnd, dlgInfo, hwndDest );
1333 }
1334 return 0;
1335
1336 case WM_ENTERMENULOOP:
1337 case WM_LBUTTONDOWN:
1338 case WM_NCLBUTTONDOWN:
1339 {
1340 HWND hwndFocus = GetFocus();
1341 if (hwndFocus)
1342 {
1343 /* always make combo box hide its listbox control */
1344 if (!SendMessageW( hwndFocus, CB_SHOWDROPDOWN, FALSE, 0 ))
1345 SendMessageW( GetParent(hwndFocus), CB_SHOWDROPDOWN, FALSE, 0 );
1346 }
1347 }
1348 return DefWindowProcA( hwnd, msg, wParam, lParam );
1349
1350 case WM_GETFONT:
1351 return dlgInfo ? (LRESULT)dlgInfo->hUserFont : 0;
1352
1353 case WM_CLOSE:
1356 return 0;
1357 }
1358 return 0;
1359}
RECT rect
Definition: combotst.c:67
#define GetProcessHeap()
Definition: compat.h:736
HANDLE HWND
Definition: compat.h:19
#define HeapFree(x, y, z)
Definition: compat.h:735
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
DWORD NTAPI NtUserSetThreadState(DWORD Unknown0, DWORD Unknown1)
Definition: misc.c:360
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static HWND hwndparent
Definition: listview.c:56
EXTINLINE VOID NtUserxSetDialogPointer(HWND hWnd, PVOID dlgInfo)
Definition: ntwrapper.h:716
#define LRESULT
Definition: ole.h:14
UINT flags
Definition: dialog.c:56
HFONT hUserFont
Definition: dialog.c:51
HMENU hMenu
Definition: dialog.c:52
INT idResult
Definition: dialog.c:55
#define MAKELONG(a, b)
Definition: typedefs.h:249
HBRUSH FASTCALL GetControlColor(PWND pwndParent, PWND pwnd, HDC hdc, UINT CtlMsg)
Definition: misc.c:153
#define DF_DIALOGACTIVE
Definition: dialog.c:38
static BOOL DEFDLG_SetDefId(HWND hwndDlg, DIALOGINFO *dlgInfo, WPARAM wParam)
Definition: dialog.c:1134
static BOOL DEFDLG_SetDefButton(HWND hwndDlg, DIALOGINFO *dlgInfo, HWND hwndNew)
Definition: dialog.c:1167
static HWND DIALOG_FindMsgDestination(HWND hwndDlg)
Definition: dialog.c:467
static void DEFDLG_SetFocus(HWND hwndCtrl)
Definition: dialog.c:705
static void DEFDLG_SaveFocus(HWND hwnd)
Definition: dialog.c:716
static void DEFDLG_RestoreFocus(HWND hwnd, BOOL justActivate)
Definition: dialog.c:731
DIALOGINFO * DIALOG_get_info(HWND hWnd, BOOL create)
Definition: dialog.c:131
int WINAPI GetDlgCtrlID(HWND hwndCtl)
Definition: dialog.c:2189
#define DF_END
Definition: dialog.c:37
BOOL WINAPI DPtoLP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HWND WINAPI GetFocus(void)
Definition: window.c:1887
#define WM_ERASEBKGND
Definition: winuser.h:1653
#define MAKEWPARAM(l, h)
Definition: winuser.h:4117
#define WM_CLOSE
Definition: winuser.h:1649
#define DM_SETDEFID
Definition: winuser.h:2135
#define IDCANCEL
Definition: winuser.h:842
#define CB_SHOWDROPDOWN
Definition: winuser.h:1999
#define WM_COMMAND
Definition: winuser.h:1768
#define DC_HASDEFID
Definition: winuser.h:2651
#define WM_SETFOCUS
Definition: winuser.h:1641
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
HWND WINAPI GetNextDlgTabItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
#define WM_GETFONT
Definition: winuser.h:1679
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_NEXTDLGCTL
Definition: winuser.h:1671
#define WM_ACTIVATE
Definition: winuser.h:1640
#define WM_SHOWWINDOW
Definition: winuser.h:1656
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define WM_ENTERMENULOOP
Definition: winuser.h:1832
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI DestroyMenu(_In_ HMENU)
#define WM_NCDESTROY
Definition: winuser.h:1712
#define BN_CLICKED
Definition: winuser.h:1954
#define DM_GETDEFID
Definition: winuser.h:2134
#define DM_REPOSITION
Definition: winuser.h:2136
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CTLCOLORDLG
Definition: winuser.h:1798
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1720

Referenced by DefDlgProcA(), and DefDlgProcW().

◆ DEFDLG_RestoreFocus()

static void DEFDLG_RestoreFocus ( HWND  hwnd,
BOOL  justActivate 
)
static

Definition at line 731 of file dialog.c.

732{
733 DIALOGINFO *infoPtr;
734
735 if (IsIconic( hwnd )) return;
736 if (!(infoPtr = GETDLGINFO(hwnd))) return;
737 /* Don't set the focus back to controls if EndDialog is already called.*/
738 if (infoPtr->flags & DF_END) return;
739 if (!IsWindow(infoPtr->hwndFocus) || infoPtr->hwndFocus == hwnd) {
740 if (justActivate) return;
741 /* If no saved focus control exists, set focus to the first visible,
742 non-disabled, WS_TABSTOP control in the dialog */
743 infoPtr->hwndFocus = GetNextDlgTabItem( hwnd, 0, FALSE );
744 /* If there are no WS_TABSTOP controls, set focus to the first visible,
745 non-disabled control in the dialog */
746 if (!infoPtr->hwndFocus) infoPtr->hwndFocus = GetNextDlgGroupItem( hwnd, 0, FALSE );
747 if (!IsWindow( infoPtr->hwndFocus )) return;
748 }
749 if (justActivate)
750 SetFocus( infoPtr->hwndFocus );
751 else
752 DEFDLG_SetFocus( infoPtr->hwndFocus );
753
754 infoPtr->hwndFocus = NULL;
755}
HWND hwndFocus
Definition: dialog.c:50
#define GETDLGINFO(hwnd)
Definition: dialog.c:39
BOOL WINAPI IsWindow(_In_opt_ HWND)
BOOL WINAPI IsIconic(_In_ HWND)
HWND WINAPI GetNextDlgGroupItem(_In_ HWND, _In_opt_ HWND, _In_ BOOL)
HWND WINAPI SetFocus(_In_opt_ HWND)

Referenced by DEFDLG_Proc().

◆ DEFDLG_SaveFocus()

static void DEFDLG_SaveFocus ( HWND  hwnd)
static

Definition at line 716 of file dialog.c.

717{
718 DIALOGINFO *infoPtr;
719 HWND hwndFocus = GetFocus();
720
721 if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return;
722 if (!(infoPtr = GETDLGINFO(hwnd))) return;
723 infoPtr->hwndFocus = hwndFocus;
724 /* Remove default button */
725}
BOOL WINAPI IsChild(_In_ HWND, _In_ HWND)

Referenced by DEFDLG_Proc().

◆ DEFDLG_SetDefButton()

static BOOL DEFDLG_SetDefButton ( HWND  hwndDlg,
DIALOGINFO dlgInfo,
HWND  hwndNew 
)
static

Need to draw only default push button rectangle. Since the next control is not a push button, need to draw the push button rectangle for the default control.

Definition at line 1167 of file dialog.c.

1168{
1169 DWORD dlgcode=0; /* initialize just to avoid a warning */
1170 HWND hwndOld = GetDlgItem( hwndDlg, dlgInfo->idResult );
1171
1172 if (hwndNew &&
1173 !((dlgcode=SendMessageW(hwndNew, WM_GETDLGCODE, 0, 0 ))
1175 {
1181 hwndNew = hwndOld;
1182 dlgcode = SendMessageW(hwndNew, WM_GETDLGCODE, 0, 0 );
1183 }
1184
1185 /* Make sure the old default control is a valid push button ID */
1186 if (!hwndOld || !(SendMessageW( hwndOld, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON))
1187 hwndOld = DEFDLG_FindDefButton( hwndDlg );
1188 if (hwndOld && hwndOld != hwndNew)
1190
1191 if (hwndNew)
1192 {
1193 if(dlgcode & DLGC_UNDEFPUSHBUTTON)
1195 }
1196 return TRUE;
1197}
#define BS_PUSHBUTTON
Definition: pedump.c:651
#define BS_DEFPUSHBUTTON
Definition: pedump.c:652
#define DLGC_UNDEFPUSHBUTTON
Definition: winuser.h:2658
#define BM_SETSTYLE
Definition: winuser.h:1953

Referenced by DEFDLG_Proc().

◆ DEFDLG_SetDefId()

static BOOL DEFDLG_SetDefId ( HWND  hwndDlg,
DIALOGINFO dlgInfo,
WPARAM  wParam 
)
static

Definition at line 1134 of file dialog.c.

1135{
1136 DWORD dlgcode=0; /* initialize just to avoid a warning */
1137 HWND hwndOld, hwndNew = GetDlgItem(hwndDlg, wParam);
1138 INT old_id = dlgInfo->idResult;
1139
1140 dlgInfo->idResult = wParam;
1141 if (hwndNew &&
1142 !((dlgcode=SendMessageW(hwndNew, WM_GETDLGCODE, 0, 0 ))
1144 return FALSE; /* Destination is not a push button */
1145
1146 /* Make sure the old default control is a valid push button ID */
1147 hwndOld = GetDlgItem( hwndDlg, old_id );
1148 if (!hwndOld || !(SendMessageW( hwndOld, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON))
1149 hwndOld = DEFDLG_FindDefButton( hwndDlg );
1150 if (hwndOld && hwndOld != hwndNew)
1152
1153 if (hwndNew)
1154 {
1155 if(dlgcode & DLGC_UNDEFPUSHBUTTON)
1157 }
1158 return TRUE;
1159}
int32_t INT
Definition: typedefs.h:58
#define DLGC_BUTTON
Definition: winuser.h:2662

Referenced by DEFDLG_Proc().

◆ DEFDLG_SetFocus()

static void DEFDLG_SetFocus ( HWND  hwndCtrl)
static

Definition at line 705 of file dialog.c.

706{
707 if (SendMessageW( hwndCtrl, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
708 SendMessageW( hwndCtrl, EM_SETSEL, 0, -1 );
709 SetFocus( hwndCtrl );
710}
#define EM_SETSEL
Definition: winuser.h:2047
#define DLGC_HASSETSEL
Definition: winuser.h:2656

Referenced by DEFDLG_Proc(), and DEFDLG_RestoreFocus().

◆ DefDlgProcA()

LRESULT WINAPI DefDlgProcA ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1731 of file dialog.c.

1736{
1737 DIALOGINFO *dlgInfo;
1738 WNDPROC dlgproc;
1739 BOOL result = FALSE;
1740
1741 /* Perform DIALOGINFO initialization if not done */
1742 if(!(dlgInfo = DIALOG_get_info( hDlg, TRUE ))) return 0;
1743
1745
1746 if ((dlgproc = (WNDPROC)GetWindowLongPtrW( hDlg, DWLP_DLGPROC )))
1747 {
1748 /* Call dialog procedure */
1749 result = CallWindowProcA( dlgproc, hDlg, Msg, wParam, lParam );
1750 }
1751
1752 if (!result && IsWindow(hDlg))
1753 {
1754 /* callback didn't process this message */
1755
1756 switch(Msg)
1757 {
1758 case WM_ERASEBKGND:
1759 case WM_SHOWWINDOW:
1760 case WM_ACTIVATE:
1761 case WM_SETFOCUS:
1762 case DM_SETDEFID:
1763 case DM_GETDEFID:
1764#ifdef __REACTOS__
1765 case DM_REPOSITION:
1766#endif
1767 case WM_NEXTDLGCTL:
1768 case WM_GETFONT:
1769 case WM_CLOSE:
1770 case WM_NCDESTROY:
1771 case WM_ENTERMENULOOP:
1772 case WM_LBUTTONDOWN:
1773 case WM_NCLBUTTONDOWN:
1774 return DEFDLG_Proc( hDlg, Msg, wParam, lParam, dlgInfo );
1775 case WM_INITDIALOG:
1776 case WM_VKEYTOITEM:
1777 case WM_COMPAREITEM:
1778 case WM_CHARTOITEM:
1779 break;
1780
1781 default:
1782 return DefWindowProcA( hDlg, Msg, wParam, lParam );
1783 }
1784 }
1785 return DEFDLG_Epilog(hDlg, Msg, wParam, lParam, result, TRUE);
1786}
struct @1792 Msg[]
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint64EXT * result
Definition: glext.h:11304
static LRESULT DEFDLG_Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, DIALOGINFO *dlgInfo)
Definition: dialog.c:1252
static LRESULT DEFDLG_Epilog(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, BOOL fResult, BOOL fAnsi)
Definition: dialog.c:1364
#define DWLP_DLGPROC
Definition: winuser.h:882
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
#define SetWindowLongPtrW
Definition: winuser.h:5512
LRESULT WINAPI CallWindowProcA(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ DefDlgProcW()

LRESULT WINAPI DefDlgProcW ( HWND  hDlg,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1794 of file dialog.c.

1799{
1800 DIALOGINFO *dlgInfo;
1801 WNDPROC dlgproc;
1802 BOOL result = FALSE;
1803
1804 /* Perform DIALOGINFO initialization if not done */
1805 if(!(dlgInfo = DIALOG_get_info( hDlg, TRUE ))) return 0;
1806
1808
1809 if ((dlgproc = (WNDPROC)GetWindowLongPtrW( hDlg, DWLP_DLGPROC )))
1810 {
1811 /* Call dialog procedure */
1812 result = CallWindowProcW( dlgproc, hDlg, Msg, wParam, lParam );
1813 }
1814
1815 if (!result && IsWindow(hDlg))
1816 {
1817 /* callback didn't process this message */
1818
1819 switch(Msg)
1820 {
1821 case WM_ERASEBKGND:
1822 case WM_SHOWWINDOW:
1823 case WM_ACTIVATE:
1824 case WM_SETFOCUS:
1825 case DM_SETDEFID:
1826 case DM_GETDEFID:
1827#ifdef __REACTOS__
1828 case DM_REPOSITION:
1829#endif
1830 case WM_NEXTDLGCTL:
1831 case WM_GETFONT:
1832 case WM_CLOSE:
1833 case WM_NCDESTROY:
1834 case WM_ENTERMENULOOP:
1835 case WM_LBUTTONDOWN:
1836 case WM_NCLBUTTONDOWN:
1837 return DEFDLG_Proc( hDlg, Msg, wParam, lParam, dlgInfo );
1838 case WM_INITDIALOG:
1839 case WM_VKEYTOITEM:
1840 case WM_COMPAREITEM:
1841 case WM_CHARTOITEM:
1842 break;
1843
1844 default:
1845 return DefWindowProcW( hDlg, Msg, wParam, lParam );
1846 }
1847 }
1848 return DEFDLG_Epilog(hDlg, Msg, wParam, lParam, result, FALSE);
1849}
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ DIALOG_CreateControls32()

static BOOL DIALOG_CreateControls32 ( HWND  hwnd,
LPCSTR  template,
const DLG_TEMPLATE dlgTemplate,
HINSTANCE  hInst,
BOOL  unicode 
)
static

Definition at line 278 of file dialog.c.

280{
281 DIALOGINFO * dlgInfo;
283 HWND hwndCtrl, hwndDefButton = 0;
284 INT items = dlgTemplate->nbItems;
285
286 if (!(dlgInfo = GETDLGINFO(hwnd))) return FALSE;
287
288 TRACE(" BEGIN\n" );
289 while (items--)
290 {
291 template = (LPCSTR)DIALOG_GetControl32( (const WORD *)template, &info,
292 dlgTemplate->dialogEx );
293 info.style &= ~WS_POPUP;
294 info.style |= WS_CHILD;
295
296 if (info.style & WS_BORDER)
297 {
298 info.style &= ~WS_BORDER;
299 info.exStyle |= WS_EX_CLIENTEDGE;
300 }
301
302 if (unicode)
303 {
304 hwndCtrl = CreateWindowExW( info.exStyle | WS_EX_NOPARENTNOTIFY,
305 info.className, info.windowName,
306 info.style | WS_CHILD,
307 MulDiv(info.x, dlgInfo->xBaseUnit, 4),
308 MulDiv(info.y, dlgInfo->yBaseUnit, 8),
309 MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
310 MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
311 hwnd, (HMENU)(ULONG_PTR)info.id,
312 hInst, (LPVOID)info.data );
313 }
314 else
315 {
316 LPSTR class = (LPSTR)info.className;
317 LPSTR caption = (LPSTR)info.windowName;
318
319 if (!IS_INTRESOURCE(class))
320 {
321 DWORD len = WideCharToMultiByte( CP_ACP, 0, info.className, -1, NULL, 0, NULL, NULL );
322 class = HeapAlloc( GetProcessHeap(), 0, len );
323 if (class != NULL)
324 WideCharToMultiByte( CP_ACP, 0, info.className, -1, class, len, NULL, NULL );
325 }
326 if (!IS_INTRESOURCE(caption))
327 {
328 DWORD len = WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, NULL, 0, NULL, NULL );
329 caption = HeapAlloc( GetProcessHeap(), 0, len );
330 if (caption != NULL)
331 WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, caption, len, NULL, NULL );
332 }
333
334 if (class != NULL && caption != NULL)
335 {
336 hwndCtrl = CreateWindowExA( info.exStyle | WS_EX_NOPARENTNOTIFY,
337 class, caption, info.style | WS_CHILD,
338 MulDiv(info.x, dlgInfo->xBaseUnit, 4),
339 MulDiv(info.y, dlgInfo->yBaseUnit, 8),
340 MulDiv(info.cx, dlgInfo->xBaseUnit, 4),
341 MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
342 hwnd, (HMENU)(ULONG_PTR)info.id,
343 hInst, (LPVOID)info.data );
344 }
345 else
346 hwndCtrl = NULL;
347 if (!IS_INTRESOURCE(class)) HeapFree( GetProcessHeap(), 0, class );
348 if (!IS_INTRESOURCE(caption)) HeapFree( GetProcessHeap(), 0, caption );
349 }
350
351 if (info.windowNameFree)
352 {
353 HeapFree( GetProcessHeap(), 0, (LPVOID)info.windowName );
354 }
355
356 if (!hwndCtrl)
357 {
358 WARN("control %s %s creation failed\n", debugstr_w(info.className),
359 debugstr_w(info.windowName));
360 if (dlgTemplate->style & DS_NOFAILCREATE) continue;
361 return FALSE;
362 }
363
364 /* Send initialisation messages to the control */
365 if (dlgInfo->hUserFont) SendMessageW( hwndCtrl, WM_SETFONT,
366 (WPARAM)dlgInfo->hUserFont, 0 );
367 if (SendMessageW(hwndCtrl, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
368 {
369 /* If there's already a default push-button, set it back */
370 /* to normal and use this one instead. */
371 if (hwndDefButton)
372 SendMessageW( hwndDefButton, BM_SETSTYLE, BS_PUSHBUTTON, FALSE );
373 hwndDefButton = hwndCtrl;
374 dlgInfo->idResult = GetWindowLongPtrA( hwndCtrl, GWLP_ID );
375 }
376 }
377 TRACE(" END\n" );
378 return TRUE;
379}
#define WARN(fmt,...)
Definition: precomp.h:61
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define WideCharToMultiByte
Definition: compat.h:111
#define IS_INTRESOURCE(x)
Definition: loader.c:613
unsigned short WORD
Definition: ntddk_ex.h:93
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_w
Definition: kernel32.h:32
UINT_PTR WPARAM
Definition: minwindef.h:174
HINSTANCE hInst
Definition: dialog.c:37
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
static TCHAR * items[]
Definition: page1.c:45
#define WS_CHILD
Definition: pedump.c:617
#define WS_EX_NOPARENTNOTIFY
Definition: pedump.c:646
#define WS_BORDER
Definition: pedump.c:625
#define TRACE(s)
Definition: solgame.cpp:4
UINT xBaseUnit
Definition: dialog.c:53
UINT yBaseUnit
Definition: dialog.c:54
WORD nbItems
Definition: dialog.c:82
DWORD style
Definition: dialog.c:79
BOOL dialogEx
Definition: dialog.c:94
char * LPSTR
Definition: typedefs.h:51
uint32_t ULONG_PTR
Definition: typedefs.h:65
static const WORD * DIALOG_GetControl32(const WORD *p, DLG_CONTROL_INFO *info, BOOL dialogEx)
Definition: dialog.c:169
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 GetWindowLongPtrA
Definition: winuser.h:4982
#define WM_SETFONT
Definition: winuser.h:1678
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR 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 DS_NOFAILCREATE
Definition: winuser.h:376
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384

Referenced by DIALOG_CreateIndirect().

◆ DIALOG_CreateIndirect()

static HWND DIALOG_CreateIndirect ( HINSTANCE  hInst,
LPCVOID  dlgTemplate,
HWND  owner,
DLGPROC  dlgProc,
LPARAM  param,
BOOL  unicode,
HWND modal_owner 
)
static

Definition at line 765 of file dialog.c.

768{
769 HWND hwnd;
770 RECT rect;
771 POINT pos;
772 SIZE size;
773 DLG_TEMPLATE template;
774 DIALOGINFO * dlgInfo = NULL;
776 HWND disabled_owner = NULL;
777 HMENU hMenu = 0;
778 HFONT hUserFont = 0;
779 UINT flags = 0;
780 UINT xBaseUnit = LOWORD(units);
781 UINT yBaseUnit = HIWORD(units);
782
783 /* Parse dialog template */
784
785 if (!dlgTemplate) return 0;
786 dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
787
788 /* Load menu */
789
790 if (template.menuName) hMenu = LoadMenuW( hInst, template.menuName );
791
792 /* Create custom font if needed */
793
794 if (template.style & DS_SETFONT)
795 {
796 HDC dc = GetDC(0);
797
798 if (template.pointSize == 0x7fff)
799 {
800 /* We get the message font from the non-client metrics */
801 NONCLIENTMETRICSW ncMetrics;
802
803 ncMetrics.cbSize = sizeof(NONCLIENTMETRICSW);
804 if (SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
805 sizeof(NONCLIENTMETRICSW), &ncMetrics, 0))
806 {
807 hUserFont = CreateFontIndirectW( &ncMetrics.lfMessageFont );
808 }
809 }
810 else
811 {
812 /* We convert the size to pixels and then make it -ve. This works
813 * for both +ve and -ve template.pointSize */
814 int pixels = MulDiv(template.pointSize, GetDeviceCaps(dc , LOGPIXELSY), 72);
815 hUserFont = CreateFontW( -pixels, 0, 0, 0, template.weight,
816 template.italic, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
818 template.faceName );
819 }
820
821 if (hUserFont)
822 {
823 SIZE charSize;
824 HFONT hOldFont = SelectObject( dc, hUserFont );
825 charSize.cx = GdiGetCharDimensions( dc, NULL, &charSize.cy );
826 if (charSize.cx)
827 {
828 xBaseUnit = charSize.cx;
829 yBaseUnit = charSize.cy;
830 }
831 SelectObject( dc, hOldFont );
832 }
833 ReleaseDC(0, dc);
834 TRACE("units = %d,%d\n", xBaseUnit, yBaseUnit );
835 }
836
837 /* Create dialog main window */
838
839 SetRect(&rect, 0, 0, MulDiv(template.cx, xBaseUnit, 4), MulDiv(template.cy, yBaseUnit, 8));
840 if (template.style & DS_CONTROL)
841 template.style &= ~(WS_CAPTION|WS_SYSMENU);
842 template.style |= DS_3DLOOK;
843 if (template.style & DS_MODALFRAME)
844 template.exStyle |= WS_EX_DLGMODALFRAME;
845 if ((template.style & DS_CONTROL) || !(template.style & WS_CHILD))
846 template.exStyle |= WS_EX_CONTROLPARENT;
847 AdjustWindowRectEx( &rect, template.style, (hMenu != 0), template.exStyle );
848 pos.x = rect.left;
849 pos.y = rect.top;
850 size.cx = rect.right - rect.left;
851 size.cy = rect.bottom - rect.top;
852
853 if (template.x == CW_USEDEFAULT16)
854 {
855 pos.x = pos.y = CW_USEDEFAULT;
856 }
857 else
858 {
859 HMONITOR monitor = 0;
860 MONITORINFO mon_info;
861
862 mon_info.cbSize = sizeof(mon_info);
863 if (template.style & DS_CENTER)
864 {
865 monitor = MonitorFromWindow( owner ? owner : GetActiveWindow(), MONITOR_DEFAULTTOPRIMARY );
866 GetMonitorInfoW( monitor, &mon_info );
867 pos.x = (mon_info.rcWork.left + mon_info.rcWork.right - size.cx) / 2;
868 pos.y = (mon_info.rcWork.top + mon_info.rcWork.bottom - size.cy) / 2;
869 }
870 else if (template.style & DS_CENTERMOUSE)
871 {
872 GetCursorPos( &pos );
873 monitor = MonitorFromPoint( pos, MONITOR_DEFAULTTOPRIMARY );
874 GetMonitorInfoW( monitor, &mon_info );
875 }
876 else
877 {
878 pos.x += MulDiv(template.x, xBaseUnit, 4);
879 pos.y += MulDiv(template.y, yBaseUnit, 8);
880 //
881 // REACTOS : Need an owner to be passed!!!
882 //
883 if (!(template.style & (WS_CHILD|DS_ABSALIGN)) && owner ) ClientToScreen( owner, &pos );
884 }
885 if ( !(template.style & WS_CHILD) )
886 {
887 INT dX, dY;
888
889 /* try to fit it into the desktop */
890
891 if (!monitor)
892 {
893 SetRect( &rect, pos.x, pos.y, pos.x + size.cx, pos.y + size.cy );
894 monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
895 GetMonitorInfoW( monitor, &mon_info );
896 }
897 if ((dX = pos.x + size.cx + GetSystemMetrics(SM_CXDLGFRAME) - mon_info.rcWork.right) > 0)
898 pos.x -= dX;
899 if ((dY = pos.y + size.cy + GetSystemMetrics(SM_CYDLGFRAME) - mon_info.rcWork.bottom) > 0)
900 pos.y -= dY;
901 if( pos.x < mon_info.rcWork.left ) pos.x = mon_info.rcWork.left;
902 if( pos.y < mon_info.rcWork.top ) pos.y = mon_info.rcWork.top;
903 }
904 }
905
906 if (modal_owner && owner)
907 {
908 HWND parent = NULL;
909 /*
910 * Owner needs to be top level window. We need to duplicate the logic from server,
911 * because we need to disable it before creating dialog window. Note that we do that
912 * even if dialog has WS_CHILD, but only for modal dialogs, which matched what
913 * Windows does.
914 */
915 while ((GetWindowLongW( owner, GWL_STYLE ) & (WS_POPUP|WS_CHILD)) == WS_CHILD)
916 {
917 parent = GetParent( owner );
918 if (!parent || parent == GetDesktopWindow()) break;
919 owner = parent;
920 }
922 if (!parent) parent = GetAncestor( owner, GA_ROOT );
923
924 if (parent)
925 {
926 owner = parent;
927
928 if (IsWindowEnabled( owner ))
929 {
930 HWND captured = NULL;
931 disabled_owner = owner;
932 EnableWindow( disabled_owner, FALSE );
933
934 captured = GetCapture();
935
936 if (captured)
937 SendMessageW(captured, WM_CANCELMODE, 0, 0);
938 }
939 }
940 *modal_owner = owner;
941 }
942
943 if (unicode)
944 {
945 hwnd = CreateWindowExW(template.exStyle, template.className, template.caption,
946 template.style & ~WS_VISIBLE, pos.x, pos.y, size.cx, size.cy,
947 owner, hMenu, hInst, NULL );
948 }
949 else
950 {
951 LPCSTR class = (LPCSTR)template.className;
952 LPCSTR caption = (LPCSTR)template.caption;
953 LPSTR class_tmp = NULL;
954 LPSTR caption_tmp = NULL;
955
956 if (!IS_INTRESOURCE(class))
957 {
958 DWORD len = WideCharToMultiByte( CP_ACP, 0, template.className, -1, NULL, 0, NULL, NULL );
959 class_tmp = HeapAlloc( GetProcessHeap(), 0, len );
960 WideCharToMultiByte( CP_ACP, 0, template.className, -1, class_tmp, len, NULL, NULL );
961 class = class_tmp;
962 }
963 if (!IS_INTRESOURCE(caption))
964 {
965 DWORD len = WideCharToMultiByte( CP_ACP, 0, template.caption, -1, NULL, 0, NULL, NULL );
966 caption_tmp = HeapAlloc( GetProcessHeap(), 0, len );
967 WideCharToMultiByte( CP_ACP, 0, template.caption, -1, caption_tmp, len, NULL, NULL );
968 caption = caption_tmp;
969 }
970 hwnd = CreateWindowExA(template.exStyle, class, caption,
971 template.style & ~WS_VISIBLE, pos.x, pos.y, size.cx, size.cy,
972 owner, hMenu, hInst, NULL );
973 HeapFree( GetProcessHeap(), 0, class_tmp );
974 HeapFree( GetProcessHeap(), 0, caption_tmp );
975 }
976
977 if (!hwnd)
978 {
979 if (hUserFont) DeleteObject( hUserFont );
980 if (hMenu) DestroyMenu( hMenu );
981 if (disabled_owner) EnableWindow( disabled_owner, TRUE );
982 return 0;
983 }
984
985 /* moved this from the top of the method to here as DIALOGINFO structure
986 will be valid only after WM_CREATE message has been handled in DefDlgProc
987 All the members of the structure get filled here using temp variables */
988 dlgInfo = DIALOG_get_info( hwnd, TRUE );
989#ifdef __REACTOS__
990 if (dlgInfo == NULL)
991 {
992 if (hUserFont) DeleteObject( hUserFont );
993 if (hMenu) DestroyMenu( hMenu );
994 if (disabled_owner) EnableWindow( disabled_owner, TRUE );
995 return 0;
996 }
997#endif
998 dlgInfo->hwndFocus = 0;
999 dlgInfo->hUserFont = hUserFont;
1000 dlgInfo->hMenu = hMenu;
1001 dlgInfo->xBaseUnit = xBaseUnit;
1002 dlgInfo->yBaseUnit = yBaseUnit;
1003 dlgInfo->flags = flags;
1004
1005 if (template.helpId) SetWindowContextHelpId( hwnd, template.helpId );
1006
1007 if (unicode) SetWindowLongPtrW( hwnd, DWLP_DLGPROC, (ULONG_PTR)dlgProc );
1008 else SetWindowLongPtrA( hwnd, DWLP_DLGPROC, (ULONG_PTR)dlgProc );
1009
1010 if (dlgProc && dlgInfo->hUserFont)
1011 SendMessageW( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
1012
1013 /* Create controls */
1014
1015 if (DIALOG_CreateControls32( hwnd, dlgTemplate, &template, hInst, unicode ))
1016 {
1017 /* Send initialisation messages and set focus */
1018
1019 if (dlgProc)
1020 {
1021 HWND focus = GetNextDlgTabItem( hwnd, 0, FALSE );
1022 if (!focus) focus = GetNextDlgGroupItem( hwnd, 0, FALSE );
1023 if (SendMessageW( hwnd, WM_INITDIALOG, (WPARAM)focus, param ) && IsWindow( hwnd ) &&
1024#ifdef __REACTOS__
1025 !(dlgInfo->flags & DF_END) && /* Ensure EndDialog wasn't called in WM_INITDIALOG */
1026#endif
1027 ((~template.style & DS_CONTROL) || (template.style & WS_VISIBLE)))
1028 {
1029 /* By returning TRUE, app has requested a default focus assignment.
1030 * WM_INITDIALOG may have changed the tab order, so find the first
1031 * tabstop control again. */
1032 focus = GetNextDlgTabItem( hwnd, 0, FALSE );
1033 if (!focus) focus = GetNextDlgGroupItem( hwnd, 0, FALSE );
1034 if (focus)
1035 {
1036 if (SendMessageW( focus, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
1037 SendMessageW( focus, EM_SETSEL, 0, MAXLONG );
1038 SetFocus( focus );
1039 }
1040 else
1041 {
1042 if (!(template.style & WS_CHILD))
1043 SetFocus( hwnd );
1044 }
1045 }
1046#ifdef __REACTOS__
1049 //DEFDLG_SaveFocus( hwnd );
1050#endif
1051 }
1052
1053#ifdef __REACTOS__
1054 /* Don't continue if the dialog has been destroyed in WM_INITDIALOG */
1055 if (!IsWindow(hwnd))
1056 return NULL;
1057
1060 SendMessageW( hwnd, WM_CHANGEUISTATE, MAKEWPARAM(UIS_INITIALIZE, 0), 0);
1061
1062 // TODO: Handle DS_SETFOREGROUND
1063
1064 /* Ensure EndDialog wasn't called in WM_INITDIALOG before making the dialog visible */
1065 if (!(dlgInfo->flags & DF_END) && (template.style & WS_VISIBLE) && !(GetWindowLongPtrW(hwnd, GWL_STYLE) & WS_VISIBLE))
1066#else
1067 if (template.style & WS_VISIBLE && !(GetWindowLongPtrW( hwnd, GWL_STYLE ) & WS_VISIBLE))
1068#endif
1069 {
1070 ShowWindow( hwnd, SW_SHOWNORMAL ); /* SW_SHOW doesn't always work */
1071 UpdateWindow( hwnd );
1072#ifdef __REACTOS__
1073 IntNotifyWinEvent(EVENT_SYSTEM_DIALOGSTART, hwnd, OBJID_WINDOW, CHILDID_SELF, 0);
1074#endif
1075 }
1076 return hwnd;
1077 }
1078 if (disabled_owner) EnableWindow( disabled_owner, TRUE );
1079#ifdef __REACTOS__
1080 IntNotifyWinEvent(EVENT_SYSTEM_DIALOGEND, hwnd, OBJID_WINDOW, CHILDID_SELF, 0);
1081#endif
1082 if( IsWindow(hwnd) )
1083 {
1085#ifdef __REACTOS__
1086 if (owner)
1087 { ERR("DIALOG_CreateIndirect 1\n");
1090 { ERR("DIALOG_CreateIndirect SFW\n");
1091 SetForegroundWindow(owner);
1092 }
1093 }
1094#endif
1095 }
1096 return 0;
1097}
Arabic default style
Definition: afstyles.h:94
#define CW_USEDEFAULT16
Definition: resource.h:7
#define ERR(fmt,...)
Definition: precomp.h:57
HDC dc
Definition: cylfrac.c:34
r parent
Definition: btrfs.c:3010
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLsizeiptr size
Definition: glext.h:5919
GLfloat units
Definition: glext.h:11727
GLbitfield flags
Definition: glext.h:7161
GLfloat param
Definition: glext.h:5796
unsigned int UINT
Definition: sysinfo.c:13
@ THREADSTATE_FOREGROUNDTHREAD
Definition: ntuser.h:2501
#define QUERY_WINDOW_FOREGROUND
Definition: ntuser.h:2853
DWORD_PTR NTAPI NtUserQueryWindow(HWND hWnd, DWORD Index)
Definition: window.c:4194
DWORD_PTR NTAPI NtUserGetThreadState(DWORD Routine)
Definition: misc.c:239
HMONITOR WINAPI MonitorFromPoint(POINT, DWORD)
HMONITOR WINAPI MonitorFromRect(LPCRECT, DWORD)
HMONITOR WINAPI MonitorFromWindow(HWND, DWORD)
#define LOWORD(l)
Definition: pedump.c:82
#define WS_CAPTION
Definition: pedump.c:624
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_POPUP
Definition: pedump.c:616
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:586
_Out_opt_ int * cx
Definition: commctrl.h:585
weight
Definition: sortkey.c:157
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
DWORD cbSize
Definition: winuser.h:3892
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
#define HIWORD(l)
Definition: typedefs.h:247
#define MAXLONG
Definition: umtypes.h:116
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:178
static BOOL DIALOG_CreateControls32(HWND hwnd, LPCSTR template, const DLG_TEMPLATE *dlgTemplate, HINSTANCE hInst, BOOL unicode)
Definition: dialog.c:278
static LPCSTR DIALOG_ParseTemplate32(LPCSTR template, DLG_TEMPLATE *result)
Definition: dialog.c:575
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
LONG WINAPI GdiGetCharDimensions(HDC, LPTEXTMETRICW, LONG *)
Definition: font.c:2341
#define FF_DONTCARE
Definition: wingdi.h:448
#define LOGPIXELSY
Definition: wingdi.h:719
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define PROOF_QUALITY
Definition: wingdi.h:438
HFONT WINAPI CreateFontW(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCWSTR)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
#define SW_SHOWNORMAL
Definition: winuser.h:781
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SetWindowLongPtrA
Definition: winuser.h:5511
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:138
#define GA_ROOT
Definition: winuser.h:2893
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI SetWindowContextHelpId(_In_ HWND, _In_ DWORD)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define WM_CANCELMODE
Definition: winuser.h:1663
BOOL WINAPI SetForegroundWindow(_In_ HWND)
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:3064
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
#define DS_3DLOOK
Definition: winuser.h:367
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define DS_MODALFRAME
Definition: winuser.h:375
BOOL WINAPI ClientToScreen(_In_ HWND, _Inout_ LPPOINT)
HWND WINAPI GetDesktopWindow(void)
Definition: window.c:628
#define DS_CENTERMOUSE
Definition: winuser.h:370
#define DS_CENTER
Definition: winuser.h:369
BOOL WINAPI UpdateWindow(_In_ HWND)
#define DS_SETFONT
Definition: winuser.h:378
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HDC WINAPI GetDC(_In_opt_ HWND)
#define SM_CXDLGFRAME
Definition: winuser.h:977
LONG WINAPI GetDialogBaseUnits(void)
Definition: dialog.c:2164
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
BOOL WINAPI IsWindowEnabled(_In_ HWND)
#define CW_USEDEFAULT
Definition: winuser.h:225
#define DS_ABSALIGN
Definition: winuser.h:368
#define SM_CYDLGFRAME
Definition: winuser.h:979
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
BOOL WINAPI DestroyWindow(_In_ HWND)
int WINAPI GetSystemMetrics(_In_ int)
HWND WINAPI GetAncestor(_In_ HWND, _In_ UINT)
Definition: window.c:929
#define DS_CONTROL
Definition: winuser.h:372
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by CreateDialogIndirectParamAorW(), DialogBoxIndirectParamAorW(), DialogBoxParamA(), and DialogBoxParamW().

◆ DIALOG_DlgDirListA()

static INT DIALOG_DlgDirListA ( HWND  hDlg,
LPSTR  spec,
INT  idLBox,
INT  idStatic,
UINT  attrib,
BOOL  combo 
)
static

Definition at line 1547 of file dialog.c.

1549{
1550 if (spec)
1551 {
1552 INT ret, len = MultiByteToWideChar( CP_ACP, 0, spec, -1, NULL, 0 );
1553 LPWSTR specW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
1554 if (specW == NULL)
1555 return FALSE;
1556 MultiByteToWideChar( CP_ACP, 0, spec, -1, specW, len );
1557 ret = DIALOG_DlgDirListW( hDlg, specW, idLBox, idStatic, attrib, combo );
1558 WideCharToMultiByte( CP_ACP, 0, specW, -1, spec, 0x7fffffff, NULL, NULL );
1559 HeapFree( GetProcessHeap(), 0, specW );
1560 return ret;
1561 }
1562 return DIALOG_DlgDirListW( hDlg, NULL, idLBox, idStatic, attrib, combo );
1563}
#define MultiByteToWideChar
Definition: compat.h:110
return ret
Definition: mutex.c:147
short WCHAR
Definition: pedump.c:58
uint16_t * LPWSTR
Definition: typedefs.h:56
static INT DIALOG_DlgDirListW(HWND hDlg, LPWSTR spec, INT idLBox, INT idStatic, UINT attrib, BOOL combo)
Definition: dialog.c:1451

Referenced by DlgDirListA(), and DlgDirListComboBoxA().

◆ DIALOG_DlgDirListW()

static INT DIALOG_DlgDirListW ( HWND  hDlg,
LPWSTR  spec,
INT  idLBox,
INT  idStatic,
UINT  attrib,
BOOL  combo 
)
static

Definition at line 1451 of file dialog.c.

1453{
1454 HWND hwnd;
1455 LPWSTR orig_spec = spec;
1456 WCHAR any[] = {'*','.','*',0};
1457 WCHAR star[] = {'*',0};
1458
1459#define SENDMSG(msg,wparam,lparam) \
1460 ((attrib & DDL_POSTMSGS) ? PostMessageW( hwnd, msg, wparam, lparam ) \
1461 : SendMessageW( hwnd, msg, wparam, lparam ))
1462
1463 TRACE("%p %s %d %d %04x\n", hDlg, debugstr_w(spec), idLBox, idStatic, attrib );
1464
1465 /* If the path exists and is a directory, chdir to it */
1466 if (!spec || !spec[0] || SetCurrentDirectoryW( spec )) spec = star;
1467 else
1468 {
1469 WCHAR *p, *p2;
1470
1471 if (!strchrW(spec, '*') && !strchrW(spec, '?'))
1472 {
1474 return FALSE;
1475 }
1476 p = spec;
1477 if ((p2 = strchrW( p, ':' ))) p = p2 + 1;
1478 if ((p2 = strrchrW( p, '\\' ))) p = p2;
1479 if ((p2 = strrchrW( p, '/' ))) p = p2;
1480 if (p != spec)
1481 {
1482 WCHAR sep = *p;
1483 *p = 0;
1484 if (!SetCurrentDirectoryW( spec ))
1485 {
1486 *p = sep; /* Restore the original spec */
1487 return FALSE;
1488 }
1489 spec = p + 1;
1490 }
1491 }
1492
1493 TRACE( "mask=%s\n", spec );
1494
1495 if (idLBox && ((hwnd = GetDlgItem( hDlg, idLBox )) != 0))
1496 {
1497 if (attrib == DDL_DRIVES) attrib |= DDL_EXCLUSIVE;
1498
1499 SENDMSG( combo ? CB_RESETCONTENT : LB_RESETCONTENT, 0, 0 );
1500 if (attrib & DDL_DIRECTORY)
1501 {
1502 if (!(attrib & DDL_EXCLUSIVE))
1503 {
1504 SENDMSG( combo ? CB_DIR : LB_DIR,
1505 attrib & ~(DDL_DIRECTORY | DDL_DRIVES),
1506 (LPARAM)spec );
1507 }
1508 SENDMSG( combo ? CB_DIR : LB_DIR,
1509 (attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE,
1510 (LPARAM)any );
1511 }
1512 else
1513 {
1514 SENDMSG( combo ? CB_DIR : LB_DIR, attrib, (LPARAM)spec );
1515 }
1516 }
1517
1518 /* Convert path specification to uppercase */
1519 if (spec) CharUpperW(spec);
1520
1521 if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0))
1522 {
1524 GetCurrentDirectoryW( sizeof(temp)/sizeof(WCHAR), temp );
1525 CharLowerW( temp );
1526 /* Can't use PostMessage() here, because the string is on the stack */
1527 SetDlgItemTextW( hDlg, idStatic, temp );
1528 }
1529
1530 if (orig_spec && (spec != orig_spec))
1531 {
1532 /* Update the original file spec */
1533 WCHAR *p = spec;
1534 while ((*orig_spec++ = *p++));
1535 }
1536
1537 return TRUE;
1538#undef SENDMSG
1539}
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI SetCurrentDirectoryW(IN LPCWSTR lpPathName)
Definition: path.c:2168
LPWSTR WINAPI CharLowerW(WCHAR *str)
Definition: string.c:1136
LPWSTR WINAPI CharUpperW(WCHAR *str)
Definition: string.c:1249
GLfloat GLfloat p
Definition: glext.h:8902
static calc_node_t temp
Definition: rpn_ieee.c:38
#define SENDMSG(msg, wparam, lparam)
#define strchrW(s, c)
Definition: unicode.h:34
#define strrchrW(s, c)
Definition: unicode.h:35
#define ERROR_NO_WILDCARD_CHARACTERS
Definition: winerror.h:1243
#define LB_DIR
Definition: winuser.h:2062
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
#define DDL_DRIVES
Definition: winuser.h:425
#define CB_RESETCONTENT
Definition: winuser.h:1988
#define CB_DIR
Definition: winuser.h:1967
#define DDL_EXCLUSIVE
Definition: winuser.h:426
#define LB_RESETCONTENT
Definition: winuser.h:2091
#define DDL_DIRECTORY
Definition: winuser.h:422

Referenced by DIALOG_DlgDirListA(), DlgDirListComboBoxW(), and DlgDirListW().

◆ DIALOG_DlgDirSelect()

static BOOL DIALOG_DlgDirSelect ( HWND  hwnd,
LPWSTR  str,
INT  len,
INT  id,
BOOL  unicode,
BOOL  combo 
)
static

Definition at line 1570 of file dialog.c.

1572{
1573 WCHAR *buffer, *ptr;
1574 INT item, size;
1575 BOOL ret;
1576 HWND listbox = GetDlgItem( hwnd, id );
1577
1578 TRACE("%p %s %d\n", hwnd, unicode ? debugstr_w(str) : debugstr_a((LPSTR)str), id );
1579 if (!listbox) return FALSE;
1580
1581 item = SendMessageW(listbox, combo ? CB_GETCURSEL : LB_GETCURSEL, 0, 0 );
1582 if (item == LB_ERR) return FALSE;
1583
1584 size = SendMessageW(listbox, combo ? CB_GETLBTEXTLEN : LB_GETTEXTLEN, item, 0 );
1585 if (size == LB_ERR) return FALSE;
1586
1587 if (!(buffer = HeapAlloc( GetProcessHeap(), 0, (size+2) * sizeof(WCHAR) ))) return FALSE;
1588
1589 SendMessageW( listbox, combo ? CB_GETLBTEXT : LB_GETTEXT, item, (LPARAM)buffer );
1590
1591 if ((ret = (buffer[0] == '['))) /* drive or directory */
1592 {
1593 if (buffer[1] == '-') /* drive */
1594 {
1595 buffer[3] = ':';
1596 buffer[4] = 0;
1597 ptr = buffer + 2;
1598 }
1599 else
1600 {
1601 buffer[strlenW(buffer)-1] = '\\';
1602 ptr = buffer + 1;
1603 }
1604 }
1605 else
1606 {
1607 /* Filenames without a dot extension must have one tacked at the end */
1608 if (strchrW(buffer, '.') == NULL)
1609 {
1610 buffer[strlenW(buffer)+1] = '\0';
1611 buffer[strlenW(buffer)] = '.';
1612 }
1613 ptr = buffer;
1614 }
1615
1616 if (!unicode)
1617 {
1618 if (len > 0 && !WideCharToMultiByte( CP_ACP, 0, ptr, -1, (LPSTR)str, len, 0, 0 ))
1619 ((LPSTR)str)[len-1] = 0;
1620 }
1621 else lstrcpynW( str, ptr, len );
1623 TRACE("Returning %d %s\n", ret, unicode ? debugstr_w(str) : debugstr_a((LPSTR)str) );
1624 return ret;
1625}
#define lstrcpynW
Definition: compat.h:738
GLuint buffer
Definition: glext.h:5915
#define debugstr_a
Definition: kernel32.h:31
const WCHAR * str
#define strlenW(s)
Definition: unicode.h:28
#define LB_ERR
Definition: winuser.h:2468
#define CB_GETLBTEXTLEN
Definition: winuser.h:1982
#define CB_GETLBTEXT
Definition: winuser.h:1981
#define LB_GETTEXT
Definition: winuser.h:2085
#define LB_GETTEXTLEN
Definition: winuser.h:2086
#define LB_GETCURSEL
Definition: winuser.h:2068
#define CB_GETCURSEL
Definition: winuser.h:1972

Referenced by DlgDirSelectComboBoxExA(), DlgDirSelectComboBoxExW(), DlgDirSelectExA(), and DlgDirSelectExW().

◆ DIALOG_DoDialogBox()

INT DIALOG_DoDialogBox ( HWND  hwnd,
HWND  owner 
)

Definition at line 495 of file dialog.c.

496{
497 DIALOGINFO * dlgInfo;
498 MSG msg;
499 INT retval;
500 BOOL bFirstEmpty;
501 PWND pWnd;
502
503 pWnd = ValidateHwnd(hwnd);
504 if (!pWnd) return -1;
505
506 if (!(dlgInfo = GETDLGINFO(hwnd))) return -1;
507
508 bFirstEmpty = TRUE;
509 if (!(dlgInfo->flags & DF_END)) /* was EndDialog called in WM_INITDIALOG ? */
510 {
511 for (;;)
512 {
513 if (!PeekMessageW( &msg, 0, 0, 0, PM_REMOVE ))
514 {
515 if (bFirstEmpty)
516 {
517 /* ShowWindow the first time the queue goes empty */
519 bFirstEmpty = FALSE;
520 }
522 {
523 /* No message present -> send ENTERIDLE and wait */
525 }
526 GetMessageW( &msg, 0, 0, 0 );
527 }
528
529 if (msg.message == WM_QUIT)
530 {
531 PostQuitMessage( msg.wParam );
532 if (!IsWindow( hwnd )) return 0;
533 break;
534 }
535
536 /*
537 * If the user is pressing Ctrl+C, send a WM_COPY message.
538 * Guido Pola, CORE-4829, Is there another way to check if the Dialog is a MessageBox?
539 */
540 if (msg.message == WM_KEYDOWN &&
541 pWnd->state & WNDS_MSGBOX && // Yes!
543 {
544 if (msg.wParam == L'C' && GetKeyState(VK_CONTROL) < 0)
545 SendMessageW(hwnd, WM_COPY, 0, 0);
546 }
547
548 if (!IsWindow( hwnd )) return 0;
549 if (!(dlgInfo->flags & DF_END) && !IsDialogMessageW( hwnd, &msg))
550 {
553 }
554 if (!IsWindow( hwnd )) return 0;
555 if (dlgInfo->flags & DF_END) break;
556
557 if (bFirstEmpty && msg.message == WM_TIMER)
558 {
560 bFirstEmpty = FALSE;
561 }
562 }
563 }
564 retval = dlgInfo->idResult;
566 return retval;
567}
#define L(x)
Definition: resources.c:13
#define WNDS_MSGBOX
Definition: ntuser.h:610
Definition: ntuser.h:694
DWORD state
Definition: ntuser.h:701
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int retval
Definition: wcstombs.cpp:91
#define ValidateHwnd(hwnd)
Definition: precomp.h:98
#define WM_QUIT
Definition: winuser.h:1651
BOOL WINAPI TranslateMessage(_In_ const MSG *)
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
BOOL WINAPI IsDialogMessageW(_In_ HWND, _In_ LPMSG)
#define MSGF_DIALOGBOX
Definition: winuser.h:1184
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define DS_NOIDLEMSG
Definition: winuser.h:377
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define VK_CONTROL
Definition: winuser.h:2239
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define WM_TIMER
Definition: winuser.h:1770
#define PM_REMOVE
Definition: winuser.h:1207
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define WM_COPY
Definition: winuser.h:1890
#define WM_KEYDOWN
Definition: winuser.h:1743
#define WM_ENTERIDLE
Definition: winuser.h:1777
SHORT WINAPI GetKeyState(_In_ int)

Referenced by DialogBoxIndirectParamAorW(), DialogBoxParamA(), and DialogBoxParamW().

◆ DIALOG_FindMsgDestination()

static HWND DIALOG_FindMsgDestination ( HWND  hwndDlg)
static

Definition at line 467 of file dialog.c.

468{
469 while (GetWindowLongA(hwndDlg, GWL_STYLE) & DS_CONTROL)
470 {
471 PWND pWnd;
472 HWND hParent = GetParent(hwndDlg);
473 if (!hParent) break;
474// ReactOS
475 if (!IsWindow(hParent)) break;
476
477 pWnd = ValidateHwnd(hParent);
478 // FIXME: Use pWnd->fnid == FNID_DESKTOP
479 if (!pWnd || !TestWindowProcess(pWnd) || hParent == GetDesktopWindow()) break;
480
481 if (!(pWnd->state & WNDS_DIALOGWINDOW))
482 {
483 break;
484 }
485
486 hwndDlg = hParent;
487 }
488
489 return hwndDlg;
490}
#define WNDS_DIALOGWINDOW
Definition: ntuser.h:621
BOOL FASTCALL TestWindowProcess(PWND)
Definition: misc.c:166
LONG WINAPI GetWindowLongA(_In_ HWND, _In_ int)

Referenced by DEFDLG_Proc(), and IsDialogMessageW().

◆ DIALOG_FixChildrenOnChangeFocus()

static void DIALOG_FixChildrenOnChangeFocus ( HWND  hwndDlg,
HWND  hwndNext 
)
static

Definition at line 2472 of file dialog.c.

2473{
2474 INT dlgcode_next = SendMessageW (hwndNext, WM_GETDLGCODE, 0, 0);
2475 /* INT dlgcode_dlg = SendMessageW (hwndDlg, WM_GETDLGCODE, 0, 0); */
2476 /* Windows does ask for this. I don't know why yet */
2477
2479
2480 /* If the button that is getting the focus WAS flagged as the default
2481 * pushbutton then ask the dialog what it thinks the default is and
2482 * set that in the default style.
2483 */
2484 if (dlgcode_next & DLGC_DEFPUSHBUTTON)
2485 {
2486 DWORD def_id = SendMessageW (hwndDlg, DM_GETDEFID, 0, 0);
2487 if (HIWORD(def_id) == DC_HASDEFID)
2488 {
2489 HWND hwndDef;
2490 def_id = LOWORD(def_id);
2491 hwndDef = GetDlgItem (hwndDlg, def_id);
2492 if (hwndDef)
2493 {
2494 INT dlgcode_def = SendMessageW (hwndDef, WM_GETDLGCODE, 0, 0);
2495 /* I know that if it is a button then it should already be a
2496 * UNDEFPUSHBUTTON, since we have just told the buttons to
2497 * change style. But maybe they ignored our request
2498 */
2499 if ((dlgcode_def & DLGC_BUTTON) &&
2500 (dlgcode_def & DLGC_UNDEFPUSHBUTTON))
2501 {
2503 }
2504 }
2505 }
2506 }
2507 else if ((dlgcode_next & DLGC_BUTTON) && (dlgcode_next & DLGC_UNDEFPUSHBUTTON))
2508 {
2510 /* I wonder why it doesn't send a DM_SETDEFID */
2511 }
2512}
static BOOL CALLBACK DIALOG_FixOneChildOnChangeFocus(HWND hwndChild, LPARAM lParam)
Definition: dialog.c:2456

Referenced by IsDialogMessageW().

◆ DIALOG_FixOneChildOnChangeFocus()

static BOOL CALLBACK DIALOG_FixOneChildOnChangeFocus ( HWND  hwndChild,
LPARAM  lParam 
)
static

Definition at line 2456 of file dialog.c.

2458{
2459 /* If a default pushbutton then no longer default */
2460 if (DLGC_DEFPUSHBUTTON & SendMessageW (hwndChild, WM_GETDLGCODE, 0, 0))
2462 return TRUE;
2463}

Referenced by DIALOG_FixChildrenOnChangeFocus().

◆ DIALOG_get_info()

DIALOGINFO * DIALOG_get_info ( HWND  hWnd,
BOOL  create 
)

Definition at line 131 of file dialog.c.

132{
133 PWND pWindow;
134 DIALOGINFO* dlgInfo;
135
136 pWindow = ValidateHwnd( hWnd );
137 if (!pWindow)
138 {
139 return NULL;
140 }
141
142 dlgInfo = pWindow->DialogPointer;
143
144 if (!dlgInfo && create)
145 {
146 if (pWindow && pWindow->cbwndExtra >= DLGWINDOWEXTRA)
147 {
148 if (!(dlgInfo = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*dlgInfo) )))
149 return NULL;
150
151 dlgInfo->idResult = IDOK;
152 NtUserxSetDialogPointer( hWnd, dlgInfo );
153 }
154 else
155 {
156 return NULL;
157 }
158 }
159
160 return dlgInfo;
161}
HWND hWnd
Definition: settings.c:17
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static const struct access_res create[16]
Definition: package.c:7505
PVOID DialogPointer
Definition: ntuser.h:766
ULONG cbwndExtra
Definition: ntuser.h:738
#define DLGWINDOWEXTRA
Definition: winuser.h:2601
#define IDOK
Definition: winuser.h:841

Referenced by DEFDLG_Proc(), DefDlgProcA(), DefDlgProcW(), and DIALOG_CreateIndirect().

◆ DIALOG_GetControl32()

static const WORD * DIALOG_GetControl32 ( const WORD p,
DLG_CONTROL_INFO info,
BOOL  dialogEx 
)
static

Definition at line 169 of file dialog.c.

171{
172 if (dialogEx)
173 {
174 info->helpId = GET_DWORD(p); p += 2;
175 info->exStyle = GET_DWORD(p); p += 2;
176 info->style = GET_DWORD(p); p += 2;
177 }
178 else
179 {
180 info->helpId = 0;
181 info->style = GET_DWORD(p); p += 2;
182 info->exStyle = GET_DWORD(p); p += 2;
183 }
184 info->x = GET_WORD(p); p++;
185 info->y = GET_WORD(p); p++;
186 info->cx = GET_WORD(p); p++;
187 info->cy = GET_WORD(p); p++;
188
189 if (dialogEx)
190 {
191 /* id is 4 bytes for DIALOGEX */
192 info->id = GET_LONG(p);
193 p += 2;
194 }
195 else
196 {
197 info->id = GET_WORD(p);
198 p++;
199 }
200
201 if (GET_WORD(p) == 0xffff)
202 {
203 static const WCHAR class_names[6][10] =
204 {
205 { 'B','u','t','t','o','n', }, /* 0x80 */
206 { 'E','d','i','t', }, /* 0x81 */
207 { 'S','t','a','t','i','c', }, /* 0x82 */
208 { 'L','i','s','t','B','o','x', }, /* 0x83 */
209 { 'S','c','r','o','l','l','B','a','r', }, /* 0x84 */
210 { 'C','o','m','b','o','B','o','x', } /* 0x85 */
211 };
212 WORD id = GET_WORD(p+1);
213 /* Windows treats dialog control class ids 0-5 same way as 0x80-0x85 */
214 if ((id >= 0x80) && (id <= 0x85)) id -= 0x80;
215 if (id <= 5)
216 {
217 info->className = class_names[id];
218 }
219 else
220 {
221 info->className = NULL;
222 /* FIXME: load other classes here? */
223 ERR("Unknown built-in class id %04x\n", id );
224 }
225 p += 2;
226 }
227 else
228 {
229 info->className = (LPCWSTR)p;
230 p += strlenW( info->className ) + 1;
231 }
232
233 if (GET_WORD(p) == 0xffff) /* Is it an integer id? */
234 {
236 info->windowName = HeapAlloc( GetProcessHeap(), 0, sizeof(L"#65535") );
237 if (info->windowName != NULL)
238 {
239 wsprintf((LPWSTR)info->windowName, L"#%u", GET_WORD(p + 1));
240 info->windowNameFree = TRUE;
241 }
242 else
243 {
244 info->windowNameFree = FALSE;
245 }
246 p += 2;
247 }
248 else
249 {
250 info->windowName = (LPCWSTR)p;
251 info->windowNameFree = FALSE;
252 p += strlenW( info->windowName ) + 1;
253 }
254
255 TRACE(" %s %s %ld, %d, %d, %d, %d, %08x, %08x, %08x\n",
256 debugstr_w( info->className ), debugstr_w( info->windowName ),
257 info->id, info->x, info->y, info->cx, info->cy,
258 info->style, info->exStyle, info->helpId );
259
260 if (GET_WORD(p))
261 {
262 info->data = p;
263 p += GET_WORD(p) / sizeof(WORD);
264 }
265 else info->data = NULL;
266 p++;
267
268 /* Next control is on dword boundary */
269 return (const WORD *)(((UINT_PTR)p + 3) & ~3);
270}
GLuint id
Definition: glext.h:5910
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274
#define GET_DWORD(ptr)
Definition: dialog.c:41
#define GET_LONG(ptr)
Definition: dialog.c:42
#define GET_WORD(ptr)
Definition: dialog.c:40
#define wsprintf
Definition: winuser.h:6031

Referenced by DIALOG_CreateControls32().

◆ DIALOG_GetNextTabItem()

static HWND DIALOG_GetNextTabItem ( HWND  hwndMain,
HWND  hwndDlg,
HWND  hwndCtrl,
BOOL  fPrevious 
)
static

Definition at line 1387 of file dialog.c.

1388{
1389 LONG dsStyle;
1390 LONG exStyle;
1391 UINT wndSearch = fPrevious ? GW_HWNDPREV : GW_HWNDNEXT;
1392 HWND retWnd = 0;
1393 HWND hChildFirst = 0;
1394
1395 if(!hwndCtrl)
1396 {
1397 hChildFirst = GetWindow(hwndDlg,GW_CHILD);
1398 if(fPrevious) hChildFirst = GetWindow(hChildFirst,GW_HWNDLAST);
1399 }
1400 else if (IsChild( hwndMain, hwndCtrl ))
1401 {
1402 hChildFirst = GetWindow(hwndCtrl,wndSearch);
1403 if(!hChildFirst)
1404 {
1405 if(GetParent(hwndCtrl) != hwndMain)
1406 /* i.e. if we are not at the top level of the recursion */
1407 hChildFirst = GetWindow(GetParent(hwndCtrl),wndSearch);
1408 else
1409 hChildFirst = GetWindow(hwndCtrl, fPrevious ? GW_HWNDLAST : GW_HWNDFIRST);
1410 }
1411 }
1412
1413 while(hChildFirst)
1414 {
1415 dsStyle = GetWindowLongPtrA(hChildFirst,GWL_STYLE);
1416 exStyle = GetWindowLongPtrA(hChildFirst,GWL_EXSTYLE);
1417 if( (exStyle & WS_EX_CONTROLPARENT) && (dsStyle & WS_VISIBLE) && !(dsStyle & WS_DISABLED))
1418 {
1419 HWND retWnd;
1420 retWnd = DIALOG_GetNextTabItem(hwndMain,hChildFirst,NULL,fPrevious );
1421 if (retWnd) return (retWnd);
1422 }
1423 else if( (dsStyle & WS_TABSTOP) && (dsStyle & WS_VISIBLE) && !(dsStyle & WS_DISABLED))
1424 {
1425 return (hChildFirst);
1426 }
1427 hChildFirst = GetWindow(hChildFirst,wndSearch);
1428 }
1429 if(hwndCtrl)
1430 {
1431 HWND hParent = GetParent(hwndCtrl);
1432 while(hParent)
1433 {
1434 if(hParent == hwndMain) break;
1435 retWnd = DIALOG_GetNextTabItem(hwndMain,GetParent(hParent),hParent,fPrevious );
1436 if(retWnd) break;
1437 hParent = GetParent(hParent);
1438 }
1439 if(!retWnd)
1440 retWnd = DIALOG_GetNextTabItem(hwndMain,hwndMain,NULL,fPrevious );
1441 }
1442 return retWnd ? retWnd : hwndCtrl;
1443}
#define WS_TABSTOP
Definition: pedump.c:634
HWND hwndMain
Definition: solitaire.cpp:13
static HWND DIALOG_GetNextTabItem(HWND hwndMain, HWND hwndDlg, HWND hwndCtrl, BOOL fPrevious)
Definition: dialog.c:1387
#define GW_HWNDFIRST
Definition: winuser.h:775
#define GW_HWNDLAST
Definition: winuser.h:776
#define GW_HWNDPREV
Definition: winuser.h:773

Referenced by DIALOG_GetNextTabItem(), and GetNextDlgTabItem().

◆ DIALOG_IdToHwnd()

static HWND DIALOG_IdToHwnd ( HWND  hwndDlg,
INT  id 
)
static

Definition at line 2522 of file dialog.c.

2523{
2524 int i;
2525 HWND *list = WIN_ListChildren( hwndDlg );
2526 HWND ret = 0;
2527
2528 if (!list) return 0;
2529
2530 for (i = 0; list[i]; i++)
2531 {
2532 if (GetWindowLongPtrW( list[i], GWLP_ID ) == id)
2533 {
2534 ret = list[i];
2535 break;
2536 }
2537
2538 /* Recurse into every child */
2539 if ((ret = DIALOG_IdToHwnd( list[i], id ))) break;
2540 }
2541
2542 HeapFree( GetProcessHeap(), 0, list );
2543 return ret;
2544}
Definition: list.h:37
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
HWND * WIN_ListChildren(HWND hWndparent)
Definition: mdi.c:139
static HWND DIALOG_IdToHwnd(HWND hwndDlg, INT id)
Definition: dialog.c:2522

Referenced by DIALOG_IdToHwnd(), and IsDialogMessageW().

◆ DIALOG_IsAccelerator()

static BOOL DIALOG_IsAccelerator ( HWND  hwnd,
HWND  hwndDlg,
WPARAM  wParam 
)
static

Definition at line 385 of file dialog.c.

386{
387 HWND hwndControl = hwnd;
388 HWND hwndNext;
389 INT dlgCode;
390 WCHAR buffer[128];
391
392 do
393 {
394 DWORD style = GetWindowLongPtrW( hwndControl, GWL_STYLE );
395 if ((style & (WS_VISIBLE | WS_DISABLED)) == WS_VISIBLE)
396 {
397 dlgCode = SendMessageW( hwndControl, WM_GETDLGCODE, 0, 0 );
398 if ( (dlgCode & (DLGC_BUTTON | DLGC_STATIC)) &&
399 GetWindowTextW( hwndControl, buffer, sizeof(buffer)/sizeof(WCHAR) ))
400 {
401 /* find the accelerator key */
402 LPWSTR p = buffer - 2;
403
404 do
405 {
406 p = strchrW( p + 2, '&' );
407 }
408 while (p != NULL && p[1] == '&');
409
410 /* and check if it's the one we're looking for */
411 if (p != NULL && toupperW( p[1] ) == toupperW( wParam ) )
412 {
413 if ((dlgCode & DLGC_STATIC) || (style & 0x0f) == BS_GROUPBOX )
414 {
415 /* set focus to the control */
416 SendMessageW( hwndDlg, WM_NEXTDLGCTL, (WPARAM)hwndControl, 1);
417 /* and bump it on to next */
418 SendMessageW( hwndDlg, WM_NEXTDLGCTL, 0, 0);
419 }
420 else if (dlgCode & DLGC_BUTTON)
421 {
422 /* send BM_CLICK message to the control */
423 SendMessageW( hwndControl, BM_CLICK, 0, 0 );
424 }
425 return TRUE;
426 }
427 }
428 hwndNext = GetWindow( hwndControl, GW_CHILD );
429 }
430 else hwndNext = 0;
431
432 if (!hwndNext) hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
433
434 while (!hwndNext && hwndControl)
435 {
436 hwndControl = GetParent( hwndControl );
437 if (hwndControl == hwndDlg)
438 {
439 if(hwnd==hwndDlg) /* prevent endless loop */
440 {
441 hwndNext=hwnd;
442 break;
443 }
444 hwndNext = GetWindow( hwndDlg, GW_CHILD );
445 }
446 else
447 hwndNext = GetWindow( hwndControl, GW_HWNDNEXT );
448 }
449 hwndControl = hwndNext;
450 }
451 while (hwndControl && (hwndControl != hwnd));
452
453 return FALSE;
454}
#define BS_GROUPBOX
Definition: pedump.c:658
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1382
#define toupperW(n)
Definition: unicode.h:45
#define BM_CLICK
Definition: winuser.h:1946
#define DLGC_STATIC
Definition: winuser.h:2661

Referenced by IsDialogMessageW().

◆ DIALOG_ParseTemplate32()

static LPCSTR DIALOG_ParseTemplate32 ( LPCSTR  template,
DLG_TEMPLATE result 
)
static

Definition at line 575 of file dialog.c.

576{
577 const WORD *p = (const WORD *)template;
579 WORD dlgver;
580
581 dlgver = GET_WORD(p); p++;
582 signature = GET_WORD(p); p++;
583
584 if (dlgver == 1 && signature == 0xffff) /* DIALOGEX resource */
585 {
586 result->dialogEx = TRUE;
587 result->helpId = GET_DWORD(p); p += 2;
588 result->exStyle = GET_DWORD(p); p += 2;
589 result->style = GET_DWORD(p); p += 2;
590 }
591 else
592 {
593 result->style = GET_DWORD(p - 2);
594 result->dialogEx = FALSE;
595 result->helpId = 0;
596 result->exStyle = GET_DWORD(p); p += 2;
597 }
598 result->nbItems = GET_WORD(p); p++;
599 result->x = GET_WORD(p); p++;
600 result->y = GET_WORD(p); p++;
601 result->cx = GET_WORD(p); p++;
602 result->cy = GET_WORD(p); p++;
603 TRACE("DIALOG%s %d, %d, %d, %d, %d\n",
604 result->dialogEx ? "EX" : "", result->x, result->y,
605 result->cx, result->cy, result->helpId );
606 TRACE(" STYLE 0x%08x\n", result->style );
607 TRACE(" EXSTYLE 0x%08x\n", result->exStyle );
608
609 /* Get the menu name */
610
611 switch(GET_WORD(p))
612 {
613 case 0x0000:
614 result->menuName = NULL;
615 p++;
616 break;
617 case 0xffff:
618 result->menuName = (LPCWSTR)(UINT_PTR)GET_WORD( p + 1 );
619 p += 2;
620 TRACE(" MENU %04x\n", LOWORD(result->menuName) );
621 break;
622 default:
623 result->menuName = (LPCWSTR)p;
624 TRACE(" MENU %s\n", debugstr_w(result->menuName) );
625 p += strlenW( result->menuName ) + 1;
626 break;
627 }
628
629 /* Get the class name */
630
631 switch(GET_WORD(p))
632 {
633 case 0x0000:
634 result->className = WC_DIALOG;
635 p++;
636 break;
637 case 0xffff:
638 result->className = (LPCWSTR)(UINT_PTR)GET_WORD( p + 1 );
639 p += 2;
640 TRACE(" CLASS %04x\n", LOWORD(result->className) );
641 break;
642 default:
643 result->className = (LPCWSTR)p;
644 TRACE(" CLASS %s\n", debugstr_w( result->className ));
645 p += strlenW( result->className ) + 1;
646 break;
647 }
648
649 /* Get the window caption */
650
651 result->caption = (LPCWSTR)p;
652 p += strlenW( result->caption ) + 1;
653 TRACE(" CAPTION %s\n", debugstr_w( result->caption ) );
654
655 /* Get the font name */
656
657 result->pointSize = 0;
658 result->faceName = NULL;
659 result->weight = FW_DONTCARE;
660 result->italic = FALSE;
661
662 if (result->style & DS_SETFONT)
663 {
664 result->pointSize = GET_WORD(p);
665 p++;
666
667 /* If pointSize is 0x7fff, it means that we need to use the font
668 * in NONCLIENTMETRICSW.lfMessageFont, and NOT read the weight,
669 * italic, and facename from the dialog template.
670 */
671 if (result->pointSize == 0x7fff)
672 {
673 /* We could call SystemParametersInfo here, but then we'd have
674 * to convert from pixel size to point size (which can be
675 * imprecise).
676 */
677 TRACE(" FONT: Using message box font\n");
678 }
679 else
680 {
681 if (result->dialogEx)
682 {
683 result->weight = GET_WORD(p); p++;
684 result->italic = LOBYTE(GET_WORD(p)); p++;
685 }
686 result->faceName = (LPCWSTR)p;
687 p += strlenW( result->faceName ) + 1;
688
689 TRACE(" FONT %d, %s, %d, %s\n",
690 result->pointSize, debugstr_w( result->faceName ),
691 result->weight, result->italic ? "TRUE" : "FALSE" );
692 }
693 }
694
695 /* First control is on dword boundary */
696 return (LPCSTR)((((UINT_PTR)p) + 3) & ~3);
697}
#define LOBYTE(W)
Definition: jmemdos.c:487
#define WC_DIALOG
Definition: undocuser.h:13
#define FW_DONTCARE
Definition: wingdi.h:368

Referenced by DIALOG_CreateIndirect().

◆ DialogBoxIndirectParamA()

INT_PTR WINAPI DialogBoxIndirectParamA ( HINSTANCE  hInstance,
LPCDLGTEMPLATE  hDialogTemplate,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  dwInitParam 
)

Definition at line 1881 of file dialog.c.

1887{
1888 return DialogBoxIndirectParamAorW( hInstance, hDialogTemplate, hWndParent, lpDialogFunc, dwInitParam, DLG_ISANSI);
1889}
INT_PTR WINAPI DialogBoxIndirectParamAorW(HINSTANCE hInstance, LPCDLGTEMPLATE hDialogTemplate, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam, DWORD Flags)
Definition: dialog.c:1857

◆ DialogBoxIndirectParamAorW()

INT_PTR WINAPI DialogBoxIndirectParamAorW ( HINSTANCE  hInstance,
LPCDLGTEMPLATE  hDialogTemplate,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  dwInitParam,
DWORD  Flags 
)

Definition at line 1857 of file dialog.c.

1864{
1865/* FIXME:
1866 * This function might be obsolete since I don't think it is exported by NT
1867 * Also wine has one more parameter identifying weather it should call
1868 * the function with unicode or not
1869 */
1870 HWND hWnd = DIALOG_CreateIndirect( hInstance, hDialogTemplate, hWndParent, lpDialogFunc, dwInitParam, Flags == DLG_ISANSI ? FALSE : TRUE, &hWndParent );
1871 if (hWnd) return DIALOG_DoDialogBox( hWnd, hWndParent );
1872 return -1;
1873}
INT DIALOG_DoDialogBox(HWND hwnd, HWND owner)
Definition: dialog.c:495

Referenced by DialogBoxIndirectParamA(), and DialogBoxIndirectParamW().

◆ DialogBoxIndirectParamW()

INT_PTR WINAPI DialogBoxIndirectParamW ( HINSTANCE  hInstance,
LPCDLGTEMPLATE  hDialogTemplate,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  dwInitParam 
)

Definition at line 1897 of file dialog.c.

1903{
1904 return DialogBoxIndirectParamAorW( hInstance, hDialogTemplate, hWndParent, lpDialogFunc, dwInitParam, 0);
1905}

◆ DialogBoxParamA()

INT_PTR WINAPI DialogBoxParamA ( HINSTANCE  hInstance,
LPCSTR  lpTemplateName,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  dwInitParam 
)

Definition at line 1913 of file dialog.c.

1919{
1920 HWND hwnd;
1921 HRSRC hrsrc;
1924 if (!(hrsrc = FindResourceA( hInstance, lpTemplateName, (LPCSTR)RT_DIALOG )) ||
1925 !(ptr = LoadResource(hInstance, hrsrc)))
1926 {
1928 return -1;
1929 }
1930 if (hWndParent != NULL && !IsWindow(hWndParent))
1931 {
1933 return 0;
1934 }
1935 hwnd = DIALOG_CreateIndirect(hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam, FALSE, &hWndParent );
1936 if (hwnd) return DIALOG_DoDialogBox(hwnd, hWndParent);
1937 return -1;
1938}
#define ERROR_INVALID_WINDOW_HANDLE
Definition: winerror.h:1226
#define ERROR_RESOURCE_NAME_NOT_FOUND
Definition: winerror.h:1478

◆ DialogBoxParamW()

INT_PTR WINAPI DialogBoxParamW ( HINSTANCE  hInstance,
LPCWSTR  lpTemplateName,
HWND  hWndParent,
DLGPROC  lpDialogFunc,
LPARAM  dwInitParam 
)

Definition at line 1946 of file dialog.c.

1952{
1953 HWND hwnd;
1954 HRSRC hrsrc;
1957 if (!(hrsrc = FindResourceW( hInstance, lpTemplateName, (LPCWSTR)RT_DIALOG )) ||
1958 !(ptr = LoadResource(hInstance, hrsrc)))
1959 {
1961 return -1;
1962 }
1963 if (hWndParent != NULL && !IsWindow(hWndParent))
1964 {
1966 return 0;
1967 }
1968 hwnd = DIALOG_CreateIndirect(hInstance, ptr, hWndParent, lpDialogFunc, dwInitParam, TRUE, &hWndParent );
1969 if (hwnd) return DIALOG_DoDialogBox(hwnd, hWndParent);
1970 return -1;
1971}

◆ DlgDirListA()

int WINAPI DlgDirListA ( HWND  hDlg,
LPSTR  lpPathSpec,
int  nIDListBox,
int  nIDStaticPath,
UINT  uFileType 
)

Definition at line 1979 of file dialog.c.

1985{
1986 return DIALOG_DlgDirListA( hDlg, lpPathSpec, nIDListBox, nIDStaticPath, uFileType, FALSE );
1987}
static INT DIALOG_DlgDirListA(HWND hDlg, LPSTR spec, INT idLBox, INT idStatic, UINT attrib, BOOL combo)
Definition: dialog.c:1547

◆ DlgDirListComboBoxA()

int WINAPI DlgDirListComboBoxA ( HWND  hDlg,
LPSTR  lpPathSpec,
int  nIDComboBox,
int  nIDStaticPath,
UINT  uFiletype 
)

Definition at line 1995 of file dialog.c.

2001{
2002 return DIALOG_DlgDirListA( hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype, TRUE );
2003}

◆ DlgDirListComboBoxW()

int WINAPI DlgDirListComboBoxW ( HWND  hDlg,
LPWSTR  lpPathSpec,
int  nIDComboBox,
int  nIDStaticPath,
UINT  uFiletype 
)

Definition at line 2011 of file dialog.c.

2017{
2018 return DIALOG_DlgDirListW( hDlg, lpPathSpec, nIDComboBox, nIDStaticPath, uFiletype, TRUE );
2019}

◆ DlgDirListW()

int WINAPI DlgDirListW ( HWND  hDlg,
LPWSTR  lpPathSpec,
int  nIDListBox,
int  nIDStaticPath,
UINT  uFileType 
)

Definition at line 2027 of file dialog.c.

2033{
2034 return DIALOG_DlgDirListW( hDlg, lpPathSpec, nIDListBox, nIDStaticPath, uFileType, FALSE );
2035}

◆ DlgDirSelectComboBoxExA()

BOOL WINAPI DlgDirSelectComboBoxExA ( HWND  hDlg,
LPSTR  lpString,
int  nCount,
int  nIDComboBox 
)

Definition at line 2043 of file dialog.c.

2048{
2049 return DIALOG_DlgDirSelect( hDlg, (LPWSTR)lpString, nCount, nIDComboBox, FALSE, TRUE );
2050}
static BOOL DIALOG_DlgDirSelect(HWND hwnd, LPWSTR str, INT len, INT id, BOOL unicode, BOOL combo)
Definition: dialog.c:1570

◆ DlgDirSelectComboBoxExW()

BOOL WINAPI DlgDirSelectComboBoxExW ( HWND  hDlg,
LPWSTR  lpString,
int  nCount,
int  nIDComboBox 
)

Definition at line 2058 of file dialog.c.

2063{
2064 return DIALOG_DlgDirSelect( hDlg, (LPWSTR)lpString, nCount, nIDComboBox, TRUE, TRUE );
2065}

◆ DlgDirSelectExA()

BOOL WINAPI DlgDirSelectExA ( HWND  hDlg,
LPSTR  lpString,
int  nCount,
int  nIDListBox 
)

Definition at line 2073 of file dialog.c.

2078{
2079 return DIALOG_DlgDirSelect( hDlg, (LPWSTR)lpString, nCount, nIDListBox, FALSE, FALSE );
2080}

◆ DlgDirSelectExW()

BOOL WINAPI DlgDirSelectExW ( HWND  hDlg,
LPWSTR  lpString,
int  nCount,
int  nIDListBox 
)

Definition at line 2088 of file dialog.c.

2093{
2094 return DIALOG_DlgDirSelect( hDlg, lpString, nCount, nIDListBox, TRUE, FALSE );
2095}

◆ EndDialog()

BOOL WINAPI EndDialog ( HWND  hwnd,
INT_PTR  retval 
)

Definition at line 2103 of file dialog.c.

2106{
2107 DIALOGINFO * dlgInfo;
2108 HWND owner;
2109 BOOL wasActive;
2110
2111 TRACE("%p %ld\n", hwnd, retval );
2112
2113 if (!(dlgInfo = GETDLGINFO(hwnd)))
2114 {
2115 ERR("got invalid window handle (%p); buggy app !?\n", hwnd);
2116 return FALSE;
2117 }
2118 wasActive = (hwnd == GetActiveWindow());
2119 dlgInfo->idResult = retval;
2120 dlgInfo->flags |= DF_END;
2121
2123 {
2124 owner = GetAncestor( hwnd, GA_PARENT);
2125 }
2126 else
2127 owner = GetWindow( hwnd, GW_OWNER );
2128
2129 if (owner)
2130 EnableWindow( owner, TRUE );
2131
2132 /* Windows sets the focus to the dialog itself in EndDialog */
2133
2134 if (wasActive && IsChild(hwnd, GetFocus()))
2135 SetFocus( hwnd );
2136
2137 /* Don't have to send a ShowWindow(SW_HIDE), just do
2138 SetWindowPos with SWP_HIDEWINDOW as done in Windows */
2139
2142
2143 if (wasActive && owner)
2144 {
2145 /* If this dialog was given an owner then set the focus to that owner. */
2146 SetActiveWindow(owner);
2147 }
2148 else if (hwnd == GetActiveWindow()) // Check it again!
2149 {
2151 }
2152
2153 /* unblock dialog loop */
2154 PostMessageA(hwnd, WM_NULL, 0, 0);
2155 return TRUE;
2156}
DWORD_PTR NTAPI NtUserCallNoParam(DWORD Routine)
Definition: simplecall.c:59
@ NOPARAM_ROUTINE_ZAPACTIVEANDFOUS
Definition: ntuser.h:1545
#define GW_OWNER
Definition: winuser.h:777
#define SWP_NOACTIVATE
Definition: winuser.h:1253
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1255
#define GA_PARENT
Definition: winuser.h:2892
#define SWP_NOSIZE
Definition: winuser.h:1256
HWND WINAPI SetActiveWindow(_In_ HWND)
#define WM_NULL
Definition: winuser.h:1635
#define SWP_HIDEWINDOW
Definition: winuser.h:1252
#define SWP_NOZORDER
Definition: winuser.h:1258

◆ GetDialogBaseUnits()

LONG WINAPI GetDialogBaseUnits ( VOID  )

Definition at line 2164 of file dialog.c.

2165{
2166 static DWORD units;
2167
2168 if (!units)
2169 {
2170 HDC hdc;
2171 SIZE size;
2172
2173 if ((hdc = GetDC(0)))
2174 {
2175 size.cx = GdiGetCharDimensions( hdc, NULL, &size.cy );
2176 if (size.cx) units = MAKELONG( size.cx, size.cy );
2177 ReleaseDC( 0, hdc );
2178 }
2179 }
2180 return units;
2181}

Referenced by CC_PaintCross(), CC_PaintTriangle(), DIALOG_CreateIndirect(), LoadDialog(), SoftModalMessageBox(), test_dpi_mapping(), and test_menu_ownerdraw().

◆ GetDlgCtrlID()

int WINAPI GetDlgCtrlID ( HWND  hwndCtl)

Definition at line 2189 of file dialog.c.

2191{
2192 return GetWindowLongPtrW( hwndCtl, GWLP_ID );
2193}

Referenced by DEFDLG_Proc(), and IsDialogMessageW().

◆ GetDlgItem()

HWND WINAPI GetDlgItem ( HWND  hDlg,
int  nIDDlgItem 
)

Definition at line 2201 of file dialog.c.

2204{
2205 int i;
2206 HWND *list;
2207 HWND ret = 0;
2208
2209 if (!hDlg) return 0;
2210
2211 list = WIN_ListChildren(hDlg);
2212 if (!list) return 0;
2213
2214 for (i = 0; list[i]; i++) if (GetWindowLongPtrW(list[i], GWLP_ID) == nIDDlgItem) break;
2215 ret = list[i];
2217// if (!ret) SetLastError(ERROR_CONTROL_ID_NOT_FOUND);
2218 return ret;
2219}
#define list
Definition: rosglue.h:35
_In_ int nIDDlgItem
Definition: winuser.h:4773

◆ GetDlgItemInt()

UINT WINAPI GetDlgItemInt ( HWND  hDlg,
int  nIDDlgItem,
BOOL lpTranslated,
BOOL  bSigned 
)

Definition at line 2227 of file dialog.c.

2232{
2233 char str[30];
2234 char * endptr;
2235 LONG_PTR result = 0;
2236
2237 if (lpTranslated) *lpTranslated = FALSE;
2238 if (!SendDlgItemMessageA(hDlg, nIDDlgItem, WM_GETTEXT, sizeof(str), (LPARAM)str))
2239 return 0;
2240 if (bSigned)
2241 {
2242 result = strtol( str, &endptr, 10 );
2243 if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
2244 return 0;
2245 if (((result == LONG_MIN) || (result == LONG_MAX)))
2246 return 0;
2247 }
2248 else
2249 {
2250 result = strtoul( str, &endptr, 10 );
2251 if (!endptr || (endptr == str)) /* Conversion was unsuccessful */
2252 return 0;
2253 if (result == ULONG_MAX) return 0;
2254 }
2255 if (lpTranslated) *lpTranslated = TRUE;
2256 return (UINT)result;
2257}
#define ULONG_MAX
Definition: limits.h:31
#define LONG_MAX
Definition: limits.h:30
#define LONG_MIN
Definition: limits.h:29
_ACRTIMP __msvcrt_long __cdecl strtol(const char *, char **, int)
Definition: string.c:1838
_ACRTIMP __msvcrt_ulong __cdecl strtoul(const char *, char **, int)
Definition: string.c:1864
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WM_GETTEXT
Definition: winuser.h:1646
LRESULT WINAPI SendDlgItemMessageA(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ GetDlgItemTextA()

UINT WINAPI GetDlgItemTextA ( HWND  hDlg,
int  nIDDlgItem,
LPSTR  lpString,
int  nMaxCount 
)

Definition at line 2265 of file dialog.c.

2270{
2271 HWND hWnd = GetDlgItem(hDlg, nIDDlgItem);
2272 if ( hWnd ) return GetWindowTextA(hWnd, lpString, nMaxCount);
2273 if ( nMaxCount ) lpString[0] = '\0';
2274 return 0;
2275}
int WINAPI GetWindowTextA(HWND hWnd, LPSTR lpString, int nMaxCount)
Definition: window.c:1300
_In_ int nMaxCount
Definition: winuser.h:5034

Referenced by AskTagProc(), COMDLG32_FR_HandleWMCommand(), getdlgitem_test_dialog_proc(), CZipPassword::OnButton(), PRINTDLG_WMCommandA(), PRINTDLG_WMInitDialog(), and test_GetDlgItemText().

◆ GetDlgItemTextW()

UINT WINAPI GetDlgItemTextW ( HWND  hDlg,
int  nIDDlgItem,
LPWSTR  lpString,
int  nMaxCount 
)

Definition at line 2283 of file dialog.c.

2288{
2289 HWND hWnd = GetDlgItem(hDlg, nIDDlgItem);
2290 if ( hWnd ) return GetWindowTextW(hWnd, lpString, nMaxCount);
2291 if ( nMaxCount ) lpString[0] = '\0';
2292 return 0;
2293}

Referenced by AddDlg_OnCommand(), BrFolder_OnOK(), CFn_WMCommand(), ComputerPageDlgProc(), CongratsDlgProc(), connections_on_notify(), CopyEventEntry(), CredDialogCommandOk(), BtrfsDeviceResize::DeviceResizeDlgProc(), DIALOG_EXECUTE_DlgProc(), DIALOG_GROUP_DlgProc(), DIALOG_PROGRAM_DlgProc(), DIALOG_SYMBOL_DlgProc(), dlgproc_addport(), dlgproc_lptconfig(), DNSSuffixPropDlgProc(), DoChangePassword(), EditActionDlg_OnOK(), EditDlg_OnCommand(), EditTypeDlg_OnOK(), FD31_StripEditControl(), FD31_Validate(), file_dlg_proc(), FinishDlgProc(), general_on_notify(), CFileDefExt::GeneralPageProc(), get_dialog_font_point_size(), GetTextFromEdit(), GinaLoadFailedWindowProc(), COpenWithDialog::Init(), BtrfsPropSheet::init_propsheet(), CDrvDefExt::InitGeneralPage(), IsValidDomainName(), LoadHive_KeyNameInHookProc(), MainWindowProc(), margin_edit_notification(), MessageBoxTextToClipboard(), NetIDPage_OnApply(), NetworkDomainPageDlgProc(), NewActionDlg_OnOK(), NewExtDlg_OnOK(), CShellLink::OnNotify(), OwnerPageDlgProc(), PickIconProc(), PRINTDLG_WMCommandW(), PRINTDLG_WMInitDialogW(), PropSheetDlgProc(), BtrfsSend::SendDlgProc(), BtrfsPropSheet::set_size_on_disk(), BtrfsSend::StartSend(), BtrfsVolPropSheet::StatsDlgProc(), SummaryDlgProc(), BtrfsSend::Thread(), BtrfsPropSheet::update_size_details_dialog(), WelcomeDlgProc(), and WindowProc().

◆ GetNextDlgGroupItem()

HWND WINAPI GetNextDlgGroupItem ( HWND  hDlg,
HWND  hCtl,
BOOL  bPrevious 
)

Definition at line 2300 of file dialog.c.

2304{
2305 HWND hwnd, hwndNext, retvalue, hwndLastGroup = 0;
2306 BOOL fLooped=FALSE;
2307 BOOL fSkipping=FALSE;
2308
2309 if (hDlg == hCtl) hCtl = NULL;
2310 if (!hCtl && bPrevious) return 0;
2311
2312 /* if the hwndCtrl is the child of the control in the hwndDlg,
2313 * then the hwndDlg has to be the parent of the hwndCtrl */
2314
2315 if (hCtl)
2316 {
2317 if (!IsChild (hDlg, hCtl)) return 0;
2318 /* Make sure hwndCtrl is a top-level child */
2319 }
2320 else
2321 {
2322 /* No ctrl specified -> start from the beginning */
2323 if (!(hCtl = GetWindow( hDlg, GW_CHILD ))) return 0;
2324 /* MSDN is wrong. bPrevious does not result in the last child */
2325
2326 /* Maybe that first one is valid. If so then we don't want to skip it*/
2328 {
2329 return hCtl;
2330 }
2331 }
2332
2333 /* Always go forward around the group and list of controls; for the
2334 * previous control keep track; for the next break when you find one
2335 */
2336 retvalue = hCtl;
2337 hwnd = hCtl;
2338 while (1)
2339 {
2340 hwndNext = GetWindow (hwnd, GW_HWNDNEXT);
2341 while (!hwndNext)
2342 {
2343 /* Climb out until there is a next sibling of the ancestor or we
2344 * reach the top (in which case we loop back to the start)
2345 */
2346 if (hDlg == GetParent (hwnd))
2347 {
2348 /* Wrap around to the beginning of the list, within the same
2349 * group. (Once only)
2350 */
2351 if (fLooped) goto end;
2352 fLooped = TRUE;
2353 hwndNext = GetWindow (hDlg, GW_CHILD);
2354 }
2355 else
2356 {
2357 hwnd = GetParent (hwnd);
2358 hwndNext = GetWindow (hwnd, GW_HWNDNEXT);
2359 }
2360 }
2361 hwnd = hwndNext;
2362
2363 /* Wander down the leading edge of controlparents */
2366 (hwndNext = GetWindow (hwnd, GW_CHILD)))
2367 hwnd = hwndNext;
2368 /* Question. If the control is a control parent but either has no
2369 * children or is not visible/enabled then if it has a WS_GROUP does
2370 * it count? For that matter does it count anyway?
2371 * I believe it doesn't count.
2372 */
2373
2375 {
2376 hwndLastGroup = hwnd;
2377 if (!fSkipping)
2378 {
2379 /* Look for the beginning of the group */
2380 fSkipping = TRUE;
2381 }
2382 }
2383
2384 if (hwnd == hCtl)
2385 {
2386 if (!fSkipping) break;
2387 if (hwndLastGroup == hwnd) break;
2388 hwnd = hwndLastGroup;
2389 fSkipping = FALSE;
2390 fLooped = FALSE;
2391 }
2392
2393 if (!fSkipping &&
2395 WS_VISIBLE)
2396 {
2397 retvalue = hwnd;
2398 if (!bPrevious) break;
2399 }
2400 }
2401end:
2402 return retvalue;
2403}
GLuint GLuint end
Definition: gl.h:1545
#define WS_GROUP
Definition: pedump.c:633

◆ GetNextDlgTabItem()

HWND WINAPI GetNextDlgTabItem ( HWND  hDlg,
HWND  hCtl,
BOOL  bPrevious 
)

Definition at line 2411 of file dialog.c.

2415{
2416 PWND pWindow;
2417
2418 pWindow = ValidateHwnd( hDlg );
2419 if (!pWindow) return NULL;
2420 if (hCtl)
2421 {
2422 pWindow = ValidateHwnd( hCtl );
2423 if (!pWindow) return NULL;
2424 }
2425
2426 /* Undocumented but tested under Win2000 and WinME */
2427 if (hDlg == hCtl) hCtl = NULL;
2428
2429 /* Contrary to MSDN documentation, tested under Win2000 and WinME
2430 * NB GetLastError returns whatever was set before the function was
2431 * called.
2432 */
2433 if (!hCtl && bPrevious) return 0;
2434
2435 return DIALOG_GetNextTabItem(hDlg, hDlg, hCtl, bPrevious);
2436}

◆ IsDialogMessageW()

BOOL WINAPI IsDialogMessageW ( HWND  hDlg,
LPMSG  lpMsg 
)

Definition at line 2552 of file dialog.c.

2555{
2556 INT dlgCode = 0;
2557
2558 if (!IsWindow( hDlg ))
2559 return FALSE;
2560
2561 if (CallMsgFilterW( lpMsg, MSGF_DIALOGBOX )) return TRUE;
2562
2563 if (hDlg == GetDesktopWindow()) return FALSE;
2564 if ((hDlg != lpMsg->hwnd) && !IsChild( hDlg, lpMsg->hwnd )) return FALSE;
2565
2566 hDlg = DIALOG_FindMsgDestination(hDlg);
2567
2568 switch(lpMsg->message)
2569 {
2570 case WM_KEYDOWN:
2571 dlgCode = SendMessageW( lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg );
2572 if (dlgCode & DLGC_WANTMESSAGE) break;
2573
2574 switch(lpMsg->wParam)
2575 {
2576 case VK_TAB:
2577 if (!(dlgCode & DLGC_WANTTAB))
2578 {
2579 BOOL fIsDialog = TRUE;
2580 WND *pWnd = ValidateHwnd(hDlg);
2581
2582 if (pWnd && TestWindowProcess(pWnd))
2583 {
2584 fIsDialog = (GETDLGINFO(hDlg) != NULL);
2585 }
2586
2587 SendMessageW(hDlg, WM_CHANGEUISTATE, MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
2588
2589 /* I am not sure under which circumstances the TAB is handled
2590 * each way. All I do know is that it does not always simply
2591 * send WM_NEXTDLGCTL. (Personally I have never yet seen it
2592 * do so but I presume someone has)
2593 */
2594 if (fIsDialog)
2595 SendMessageW( hDlg, WM_NEXTDLGCTL, (GetKeyState(VK_SHIFT) & 0x8000), 0 );
2596 else
2597 {
2598 /* It would appear that GetNextDlgTabItem can handle being
2599 * passed hwndDlg rather than NULL but that is undocumented
2600 * so let's do it properly
2601 */
2602 HWND hwndFocus = GetFocus();
2603 HWND hwndNext = GetNextDlgTabItem (hDlg,
2604 hwndFocus == hDlg ? NULL : hwndFocus,
2605 GetKeyState (VK_SHIFT) & 0x8000);
2606 if (hwndNext)
2607 {
2608 dlgCode = SendMessageW (hwndNext, WM_GETDLGCODE,
2609 lpMsg->wParam, (LPARAM)lpMsg);
2610 if (dlgCode & DLGC_HASSETSEL)
2611 {
2612 INT maxlen = 1 + SendMessageW (hwndNext, WM_GETTEXTLENGTH, 0, 0);
2613 WCHAR *buffer = HeapAlloc (GetProcessHeap(), 0, maxlen * sizeof(WCHAR));
2614 if (buffer)
2615 {
2616 SIZE_T length;
2617 SendMessageW (hwndNext, WM_GETTEXT, maxlen, (LPARAM) buffer);
2618 length = strlenW (buffer);
2620 SendMessageW (hwndNext, EM_SETSEL, 0, length);
2621 }
2622 }
2623 SetFocus (hwndNext);
2624 DIALOG_FixChildrenOnChangeFocus (hDlg, hwndNext);
2625 }
2626 else
2627 return FALSE;
2628 }
2629 return TRUE;
2630 }
2631 break;
2632
2633 case VK_RIGHT:
2634 case VK_DOWN:
2635 case VK_LEFT:
2636 case VK_UP:
2637 if (!(dlgCode & DLGC_WANTARROWS))
2638 {
2639 BOOL fPrevious = (lpMsg->wParam == VK_LEFT || lpMsg->wParam == VK_UP);
2640
2641 /* Skip STATIC elements when arrow-moving through a list of controls */
2642 HWND hwndNext, hwndFirst = lpMsg->hwnd;
2643 for (hwndNext = GetNextDlgGroupItem(hDlg, hwndFirst, fPrevious);
2644 hwndNext && hwndFirst != hwndNext;
2645 hwndNext = GetNextDlgGroupItem(hDlg, hwndNext, fPrevious))
2646 {
2647 if (!(SendMessageW(hwndNext, WM_GETDLGCODE, 0, 0) & DLGC_STATIC))
2648 break;
2649 }
2650
2651 if (hwndNext &&
2652 ((SendMessageW(hwndNext, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg) &
2654 {
2655 SetFocus( hwndNext );
2656 if ((GetWindowLongW( hwndNext, GWL_STYLE ) & BS_TYPEMASK) == BS_AUTORADIOBUTTON &&
2657 SendMessageW( hwndNext, BM_GETCHECK, 0, 0 ) != BST_CHECKED)
2658 SendMessageW(hwndNext, BM_CLICK, 0, 0);
2659 }
2660 else
2661 SendMessageW( hDlg, WM_NEXTDLGCTL, (WPARAM)hwndNext, 1 );
2662 return TRUE;
2663 }
2664 break;
2665
2666 case VK_CANCEL:
2667 case VK_ESCAPE:
2669 return TRUE;
2670
2671 case VK_EXECUTE:
2672 case VK_RETURN:
2673 {
2674 DWORD dw;
2675 HWND hwndFocus = GetFocus();
2676 if (IsChild( hDlg, hwndFocus ) &&
2677 (SendMessageW (hwndFocus, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON))
2678 {
2679 SendMessageW( hDlg, WM_COMMAND, MAKEWPARAM( GetDlgCtrlID( hwndFocus ), BN_CLICKED ), (LPARAM)hwndFocus );
2680 }
2681 else if (DC_HASDEFID == HIWORD(dw = SendMessageW (hDlg, DM_GETDEFID, 0, 0)))
2682 {
2683 HWND hwndDef = DIALOG_IdToHwnd(hDlg, LOWORD(dw));
2684 if (!hwndDef || IsWindowEnabled(hwndDef))
2686 }
2687 else
2688 {
2689 SendMessageW( hDlg, WM_COMMAND, IDOK, (LPARAM)GetDlgItem( hDlg, IDOK ) );
2690 }
2691 }
2692 return TRUE;
2693 }
2694 break;
2695
2696 case WM_CHAR:
2697 /* FIXME Under what circumstances does WM_GETDLGCODE get sent?
2698 * It does NOT get sent in the test program I have
2699 */
2700 dlgCode = SendMessageW( lpMsg->hwnd, WM_GETDLGCODE, lpMsg->wParam, (LPARAM)lpMsg );
2701 if (dlgCode & (DLGC_WANTCHARS|DLGC_WANTMESSAGE)) break;
2702 if (lpMsg->wParam == '\t' && (dlgCode & DLGC_WANTTAB)) break;
2703 /* drop through */
2704
2705 case WM_SYSCHAR:
2706 if (DIALOG_IsAccelerator( lpMsg->hwnd, hDlg, lpMsg->wParam ))
2707 {
2708 /* don't translate or dispatch */
2709 return TRUE;
2710 }
2711 break;
2713 case WM_SYSKEYDOWN:
2714 /* If the ALT key is being pressed display the keyboard cues */
2715 if ( HIWORD(lpMsg->lParam) & KF_ALTDOWN &&
2716 !(gpsi->dwSRVIFlags & SRVINFO_KBDPREF) && !(gpsi->PUSIFlags & PUSIF_KEYBOARDCUES) )
2717 SendMessageW(hDlg, WM_CHANGEUISTATE, MAKEWPARAM(UIS_CLEAR, UISF_HIDEACCEL | UISF_HIDEFOCUS), 0);
2718 break;
2719
2720 case WM_SYSCOMMAND:
2721 /* If the ALT key is being pressed display the keyboard cues */
2722 if ( lpMsg->wParam == SC_KEYMENU &&
2723 !(gpsi->dwSRVIFlags & SRVINFO_KBDPREF) && !(gpsi->PUSIFlags & PUSIF_KEYBOARDCUES) )
2724 {
2725 SendMessageW(hDlg, WM_CHANGEUISTATE, MAKEWPARAM(UIS_CLEAR, UISF_HIDEACCEL | UISF_HIDEFOCUS), 0);
2726 }
2727 break;
2728 }
2729
2730 TranslateMessage( lpMsg );
2731 DispatchMessageW( lpMsg );
2732 return TRUE;
2733}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
PSERVERINFO gpsi
Definition: imm.c:18
#define SRVINFO_KBDPREF
Definition: ntuser.h:952
#define PUSIF_KEYBOARDCUES
Definition: ntuser.h:997
REFIID LPVOID DWORD_PTR dw
Definition: atlbase.h:40
#define BS_AUTORADIOBUTTON
Definition: pedump.c:660
UINT message
Definition: winuser.h:3223
HWND hwnd
Definition: winuser.h:3222
WPARAM wParam
Definition: winuser.h:3224
DWORD dwSRVIFlags
Definition: ntuser.h:1051
ULONG_PTR SIZE_T
Definition: typedefs.h:80
static void DIALOG_FixChildrenOnChangeFocus(HWND hwndDlg, HWND hwndNext)
Definition: dialog.c:2472
static BOOL DIALOG_IsAccelerator(HWND hwnd, HWND hwndDlg, WPARAM wParam)
Definition: dialog.c:385
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647
#define WM_SYSCOMMAND
Definition: winuser.h:1769
#define SC_KEYMENU
Definition: winuser.h:2632
#define VK_TAB
Definition: winuser.h:2235
#define DLGC_WANTCHARS
Definition: winuser.h:2660
#define DLGC_WANTTAB
Definition: winuser.h:2653
#define BS_TYPEMASK
Definition: winuser.h:270
#define KF_ALTDOWN
Definition: winuser.h:2485
#define VK_CANCEL
Definition: winuser.h:2228
#define VK_UP
Definition: winuser.h:2261
BOOL WINAPI CallMsgFilterW(_In_ LPMSG, _In_ INT)
#define WM_SYSCHAR
Definition: winuser.h:1749
#define VK_RETURN
Definition: winuser.h:2237
#define DLGC_RADIOBUTTON
Definition: winuser.h:2659
#define DLGC_WANTARROWS
Definition: winuser.h:2652
#define WM_CHAR
Definition: winuser.h:1745
#define VK_LEFT
Definition: winuser.h:2260
#define VK_RIGHT
Definition: winuser.h:2262
#define VK_DOWN
Definition: winuser.h:2263
#define VK_SHIFT
Definition: winuser.h:2238
#define DLGC_WANTMESSAGE
Definition: winuser.h:2655
#define VK_EXECUTE
Definition: winuser.h:2266
#define VK_ESCAPE
Definition: winuser.h:2250
#define WM_SYSKEYDOWN
Definition: winuser.h:1747
#define BM_GETCHECK
Definition: winuser.h:1947

◆ IsDlgButtonChecked()

UINT WINAPI IsDlgButtonChecked ( HWND  hDlg,
int  nIDButton 
)

Definition at line 2741 of file dialog.c.

2744{
2745 return (UINT)SendDlgItemMessageW( hDlg, nIDButton, BM_GETCHECK, 0, 0 );
2746}

◆ MapDialogRect()

BOOL WINAPI MapDialogRect ( HWND  hDlg,
LPRECT  lpRect 
)

Definition at line 2754 of file dialog.c.

2757{
2758 DIALOGINFO * dlgInfo;
2759 if (!(dlgInfo = GETDLGINFO(hDlg))) return FALSE;
2760 lpRect->left = MulDiv(lpRect->left, dlgInfo->xBaseUnit, 4);
2761 lpRect->right = MulDiv(lpRect->right, dlgInfo->xBaseUnit, 4);
2762 lpRect->top = MulDiv(lpRect->top, dlgInfo->yBaseUnit, 8);
2763 lpRect->bottom = MulDiv(lpRect->bottom, dlgInfo->yBaseUnit, 8);
2764 return TRUE;
2765}

◆ SendDlgItemMessageA()

LRESULT WINAPI SendDlgItemMessageA ( HWND  hDlg,
int  nIDDlgItem,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 2773 of file dialog.c.

2779{
2780 HWND hwndCtrl;
2781 if ( hDlg == HWND_TOPMOST || hDlg == HWND_BROADCAST ) return 0; // ReactOS
2782 hwndCtrl = GetDlgItem( hDlg, nIDDlgItem );
2783 if (hwndCtrl) return SendMessageA( hwndCtrl, Msg, wParam, lParam );
2784 else return 0;
2785}
#define HWND_TOPMOST
Definition: winuser.h:1219
#define HWND_BROADCAST
Definition: winuser.h:1215
LRESULT WINAPI SendMessageA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ SendDlgItemMessageW()

LRESULT WINAPI SendDlgItemMessageW ( HWND  hDlg,
int  nIDDlgItem,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 2793 of file dialog.c.

2799{
2800 HWND hwndCtrl;
2801 if ( hDlg == HWND_TOPMOST || hDlg == HWND_BROADCAST ) return 0; // ReactOS
2802 hwndCtrl = GetDlgItem( hDlg, nIDDlgItem );
2803 if (hwndCtrl) return SendMessageW( hwndCtrl, Msg, wParam, lParam );
2804 else return 0;
2805}

◆ SetDlgItemInt()

BOOL WINAPI SetDlgItemInt ( HWND  hDlg,
int  nIDDlgItem,
UINT  uValue,
BOOL  bSigned 
)

Definition at line 2813 of file dialog.c.

2818{
2819 char str[20];
2820
2821 if (bSigned) sprintf( str, "%d", (INT)uValue );
2822 else sprintf( str, "%u", uValue );
2824 return TRUE;
2825}
#define sprintf
Definition: sprintf.c:45
#define WM_SETTEXT
Definition: winuser.h:1645

◆ SetDlgItemTextA()

BOOL WINAPI SetDlgItemTextA ( HWND  hDlg,
int  nIDDlgItem,
LPCSTR  lpString 
)

Definition at line 2833 of file dialog.c.

2837{
2838 HWND hwndCtrl = GetDlgItem( hDlg, nIDDlgItem ); // ReactOS Themes
2839 if (hwndCtrl) return SetWindowTextA( hwndCtrl, lpString );
2840 return FALSE;
2841}
BOOL WINAPI SetWindowTextA(_In_ HWND, _In_opt_ LPCSTR)

◆ SetDlgItemTextW()

BOOL WINAPI SetDlgItemTextW ( HWND  hDlg,
int  nIDDlgItem,
LPCWSTR  lpString 
)

Definition at line 2849 of file dialog.c.

2853{
2854 HWND hwndCtrl = GetDlgItem( hDlg, nIDDlgItem ); // ReactOS Themes
2855 if (hwndCtrl) return SetWindowTextW( hwndCtrl, lpString );
2856 return FALSE;
2857}
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )

Variable Documentation

◆ DIALOG_builtin_class

const struct builtin_class_descr DIALOG_builtin_class
Initial value:
=
{
0
}
LRESULT WINAPI DefDlgProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_ARROW
Definition: winuser.h:695
#define CS_DBLCLKS
Definition: winuser.h:659
LRESULT WINAPI DefDlgProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CS_SAVEBITS
Definition: winuser.h:665

Definition at line 109 of file dialog.c.