Send WM_CTLCOLOREDIT not WM_CTLCOLORSTATIC messages to parent of a

disabled edit control if the application expects a windows version
before WIN95 and NT40.
This commit is contained in:
Rein Klazes 1999-11-10 19:55:29 +00:00 committed by Alexandre Julliard
parent 0ea089b6a8
commit 077ec0cffd
3 changed files with 32 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include "debugtools.h" #include "debugtools.h"
#include "callback.h" #include "callback.h"
#include "tweak.h" #include "tweak.h"
#include "winversion.h"
DECLARE_DEBUG_CHANNEL(combo) DECLARE_DEBUG_CHANNEL(combo)
DECLARE_DEBUG_CHANNEL(edit) DECLARE_DEBUG_CHANNEL(edit)
@ -3103,7 +3104,8 @@ static LRESULT EDIT_WM_EraseBkGnd(WND *wnd, EDITSTATE *es, HDC dc)
HBRUSH brush; HBRUSH brush;
RECT rc; RECT rc;
if (!es->bEnableState || (es->style & ES_READONLY)) if ( VERSION_AppWinVer() >= 0x40000 &&(
!es->bEnableState || (es->style & ES_READONLY)))
brush = (HBRUSH)EDIT_SEND_CTLCOLORSTATIC(wnd, dc); brush = (HBRUSH)EDIT_SEND_CTLCOLORSTATIC(wnd, dc);
else else
brush = (HBRUSH)EDIT_SEND_CTLCOLOR(wnd, dc); brush = (HBRUSH)EDIT_SEND_CTLCOLOR(wnd, dc);
@ -3710,7 +3712,8 @@ static void EDIT_WM_Paint(WND *wnd, EDITSTATE *es, WPARAM wParam)
} }
if (es->font) if (es->font)
old_font = SelectObject(dc, es->font); old_font = SelectObject(dc, es->font);
if (!es->bEnableState || (es->style & ES_READONLY)) if ( VERSION_AppWinVer() >= 0x40000 &&(
!es->bEnableState || (es->style & ES_READONLY)))
EDIT_SEND_CTLCOLORSTATIC(wnd, dc); EDIT_SEND_CTLCOLORSTATIC(wnd, dc);
else else
EDIT_SEND_CTLCOLOR(wnd, dc); EDIT_SEND_CTLCOLOR(wnd, dc);

View File

@ -16,5 +16,6 @@ typedef enum
extern WINDOWS_VERSION VERSION_GetVersion(void); extern WINDOWS_VERSION VERSION_GetVersion(void);
extern char *VERSION_GetVersionName(void); extern char *VERSION_GetVersionName(void);
extern BOOL VERSION_OsIsUnicode(void); extern BOOL VERSION_OsIsUnicode(void);
extern DWORD VERSION_AppWinVer(void);
#endif /* __WINE_WINVERSION_H */ #endif /* __WINE_WINVERSION_H */

View File

@ -317,6 +317,32 @@ WINDOWS_VERSION VERSION_GetVersion(void)
return pdb->winver; return pdb->winver;
} }
/**********************************************************************
* VERSION_AppWinVer
* Returns the window version in case Wine emulates a later version
* of windows then the application expects.
*
* In a number of cases when windows runs an application that was
* designed for an earlier windows version, windows reverts
* to "old" behaviour of that earlier version.
*
* An example is a disabled edit control that needs to be painted.
* Old style behaviour is to send a WM_CTLCOLOREDIT message. This was
* changed in Win95, NT4.0 by a WM_CTLCOLORSTATIC message _only_ for
* applications with an expected version 0f 4.0 or higher.
*
*/
DWORD VERSION_AppWinVer(void)
{
WINDOWS_VERSION ver = VERSION_GetVersion();
DWORD dwEmulatedVersion=MAKELONG( VersionData[ver].getVersionEx.dwMinorVersion,
VersionData[ver].getVersionEx.dwMajorVersion);
/* fixme: this may not be 100% correct; see discussion on the
* wine developer list in Nov 1999 */
DWORD dwProcVersion = GetProcessVersion(0);
return dwProcVersion < dwEmulatedVersion ? dwProcVersion : dwEmulatedVersion;
}
/********************************************************************** /**********************************************************************
* VERSION_GetVersionName * VERSION_GetVersionName