From 25a93ac224d627c4abf2905f237b5abcd2a6ffab Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Mon, 12 Oct 2009 09:50:57 +0000 Subject: [PATCH] GetDlgItem: Change to WINE's implementation as ours was incorrect. Remove function GetDlgItemEnumProc and struct GETDLGITEMINFO as they are no longer needed. Fixes drawing issues in Open and Save dialogs for OpenOffice. svn path=/trunk/; revision=43392 --- reactos/dll/win32/user32/windows/dialog.c | 40 ++++++----------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/reactos/dll/win32/user32/windows/dialog.c b/reactos/dll/win32/user32/windows/dialog.c index 3b4c0307a22..109c936b3da 100644 --- a/reactos/dll/win32/user32/windows/dialog.c +++ b/reactos/dll/win32/user32/windows/dialog.c @@ -104,13 +104,6 @@ typedef struct BOOL dialogEx; } DLG_TEMPLATE; -/* GetDlgItem structure */ -typedef struct -{ - INT nIDDlgItem; - HWND control; -} GETDLGITEMINFO; - /* CheckRadioButton structure */ typedef struct { @@ -1461,22 +1454,6 @@ static BOOL DIALOG_DlgDirSelect( HWND hwnd, LPWSTR str, INT len, return ret; } -/*********************************************************************** - * GetDlgItemEnumProc - * - * Callback for GetDlgItem - */ -BOOL CALLBACK GetDlgItemEnumProc (HWND hwnd, LPARAM lParam ) -{ - GETDLGITEMINFO * info = (GETDLGITEMINFO *)lParam; - if(info->nIDDlgItem == GetWindowLongPtrW( hwnd, GWL_ID )) - { - info->control = hwnd; - return FALSE; - } - return TRUE; -} - /* FUNCTIONS *****************************************************************/ @@ -2029,13 +2006,16 @@ GetDlgItem( HWND hDlg, int nIDDlgItem) { - GETDLGITEMINFO info; - info.nIDDlgItem = nIDDlgItem; - info.control = 0; - if(hDlg && !EnumChildWindows(hDlg, (WNDENUMPROC)&GetDlgItemEnumProc, (LPARAM)&info)) - return info.control; - else - return 0; + int i; + HWND *list = WIN_ListChildren(hDlg); + HWND ret = 0; + + if (!list) return 0; + + for (i = 0; list[i]; i++) if (GetWindowLongPtrW(list[i], GWLP_ID) == nIDDlgItem) break; + ret = list[i]; + HeapFree(GetProcessHeap(), 0, list); + return ret; }