Author: jimtabor
Date: Mon Oct 24 14:16:53 2011
New Revision: 54248
URL:
http://svn.reactos.org/svn/reactos?rev=54248&view=rev
Log:
[User32]
- Use SetWindowTextA/W so that it passes through defwnd to be processed for themes.
- Fix validation of the dialog window and procedure.
Modified:
trunk/reactos/dll/win32/user32/windows/dialog.c
Modified: trunk/reactos/dll/win32/user32/windows/dialog.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/dialog.c [iso-8859-1] Mon Oct 24 14:16:53 2011
@@ -138,27 +138,34 @@
PWND pWindow;
DIALOGINFO* dlgInfo = (DIALOGINFO *)GetWindowLongPtrW( hWnd, DWLP_ROS_DIALOGINFO );
- if(!dlgInfo && create)
- {
- pWindow = ValidateHwnd( hWnd );
- if (!pWindow)
- {
- SetLastError( ERROR_INVALID_WINDOW_HANDLE );
+ pWindow = ValidateHwnd( hWnd );
+ if (!pWindow)
+ {
+ return NULL;
+ }
+
+ if (!dlgInfo && create)
+ {
+ if (pWindow && pWindow->cbwndExtra >= DLGWINDOWEXTRA && hWnd
!= GetDesktopWindow())
+ {
+ if (!(dlgInfo = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*dlgInfo) )))
+ return NULL;
+
+ SETDLGINFO( hWnd, dlgInfo );
+
+ NtUserxSetDialogPointer( hWnd, dlgInfo );
+ }
+ else
+ {
return NULL;
- }
-
- if (pWindow && pWindow->cbwndExtra >= DLGWINDOWEXTRA &&
hWnd != GetDesktopWindow())
- {
- if (!(dlgInfo = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(*dlgInfo) )))
- return NULL;
-
- SETDLGINFO( hWnd, dlgInfo );
-
- NtUserxSetDialogPointer( hWnd, dlgInfo );
- }
- else
- {
- return NULL;
+ }
+ }
+ else
+ {
+ if (!(pWindow->state & WNDS_DIALOGWINDOW) || pWindow->fnid !=
FNID_DIALOG)
+ {
+ ERR("Wrong window class for Dialog!\n");
+ return NULL;
}
}
return dlgInfo;
@@ -2573,6 +2580,7 @@
WPARAM wParam,
LPARAM lParam)
{
+ if ( hDlg == HWND_TOPMOST || hDlg == HWND_BROADCAST ) return 0; // ReactOS
HWND hwndCtrl = GetDlgItem( hDlg, nIDDlgItem );
if (hwndCtrl) return SendMessageA( hwndCtrl, Msg, wParam, lParam );
else return 0;
@@ -2591,6 +2599,7 @@
WPARAM wParam,
LPARAM lParam)
{
+ if ( hDlg == HWND_TOPMOST || hDlg == HWND_BROADCAST ) return 0; // ReactOS
HWND hwndCtrl = GetDlgItem( hDlg, nIDDlgItem );
if (hwndCtrl) return SendMessageW( hwndCtrl, Msg, wParam, lParam );
else return 0;
@@ -2627,7 +2636,9 @@
int nIDDlgItem,
LPCSTR lpString)
{
- return SendDlgItemMessageA( hDlg, nIDDlgItem, WM_SETTEXT, 0, (LPARAM)lpString );
+ HWND hwndCtrl = GetDlgItem( hDlg, nIDDlgItem ); // ReactOS Themes
+ if (hwndCtrl) return SetWindowTextA( hwndCtrl, lpString );
+ return FALSE;
}
@@ -2641,7 +2652,9 @@
int nIDDlgItem,
LPCWSTR lpString)
{
- return SendDlgItemMessageW( hDlg, nIDDlgItem, WM_SETTEXT, 0, (LPARAM)lpString );
+ HWND hwndCtrl = GetDlgItem( hDlg, nIDDlgItem ); // ReactOS Themes
+ if (hwndCtrl) return SetWindowTextW( hwndCtrl, lpString );
+ return FALSE;
}