[Bug 51899] 16-bit Collins Dictionary has black background.
WineHQ Bugzilla
wine-bugs at winehq.org
Wed Oct 27 05:49:08 CDT 2021
https://bugs.winehq.org/show_bug.cgi?id=51899
--- Comment #25 from Bruni <earns.61 at gmail.com> ---
Some tests on real Windows' SetTextColor show how it reacts to misformed
COLORREF argument.
SetTextColor from Windows 7 behaves the same way as SetTextColor from Wine in
regards to 0xFFFFFFFF: it makes the text black.
Consider the following program:
(Note the lines
...
case WM_CTLCOLORSTATIC:> case WM_CTLCOLORSTATIC:
{
SetBkMode((HDC)wParam,TRANSPARENT);
SetTextColor((HDC)wParam, 0x00FF0000);
...
)
//Main.cpp
#ifndef UNICODE
#define UNICODE
#endif
#ifndef _UNICODE
#define _UNICODE
#endif
#include <windows.h>
#define IDC_LABEL1 2000
LRESULT CALLBACK fnWndProc(HWND hWnd, unsigned int msg,
WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_CREATE:
{
HINSTANCE hIns = ((LPCREATESTRUCT)lParam)->hInstance;
HWND hCtl = CreateWindowEx(0,L"static",L"Label1",
WS_CHILD|WS_VISIBLE,40,40,80,30,hWnd,(HMENU)IDC_LABEL1,hIns,0);
return 0;
}
case WM_CTLCOLORSTATIC:
// Do not allow DefWindowProc() to process this message!
// When a WM_CTLCOLORSTATIC message comes through, return
// from the Window Procedure call without a DefWindowProc()
// call. Instead return the HBRUSH stored as an instance
// variable as part of the WNDCLASSEX object.
{
SetBkMode((HDC)wParam,TRANSPARENT);
SetTextColor((HDC)wParam, 0x00FF0000);
return GetWindowLongPtr(hWnd,0*sizeof(void*));
}
case WM_DESTROY:
{
PostQuitMessage(0);
return 0;
}
}
return (DefWindowProc(hWnd, msg, wParam, lParam));
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevIns,
LPSTR lpszArgument, int iShow)
{
wchar_t szClassName[]=L"Form1";
WNDCLASSEX wc;
MSG messages;
HWND hWnd;
memset(&wc,0,sizeof(WNDCLASSEX));
HBRUSH hBrush = CreateSolidBrush(RGB(255,255,222));
wc.lpszClassName = szClassName;
wc.lpfnWndProc = fnWndProc;
wc.cbSize = sizeof(WNDCLASSEX);
wc.hbrBackground = hBrush;
wc.hInstance = hInstance;
wc.cbWndExtra = sizeof(void*);
RegisterClassEx(&wc);
hWnd=CreateWindowEx(0,szClassName,szClassName,WS_OVERLAPPEDWINDOW,
200,175,320,200,HWND_DESKTOP,0,hInstance,0);
SetWindowLongPtr(hWnd,0*sizeof(void*),(LONG_PTR)hBrush);
ShowWindow(hWnd,iShow);
while(GetMessage(&messages,NULL,0,0))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
DeleteObject(hBrush);
return messages.wParam;
}
Results:
SetTextColor((HDC)wParam, 0x00FF0000); => blue text in Windows 7
SetTextColor((HDC)wParam, 0x0000FF00); => green text in Windows 7
SetTextColor((HDC)wParam, 0x000000FF); => red text in Windows 7
SetTextColor((HDC)wParam, 0x00000000); => black text in Windows 7
SetTextColor((HDC)wParam, 0x00FFFFFF); => white text in Windows 7
But
SetTextColor((HDC)wParam, 0xFFFFFFFF); => black text in Windows 7!
So Wine's dib engine behaves just like the dib engine from Windows in this
aspect.
The bug is definitely in SetTextColor or in its callers.
--
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.
More information about the wine-bugs
mailing list