I have problem with following example. If wc.hbrBackground is set (line
16) text printed with TextOut is overpainted with that color. If I
comment out that line everything is OK. Under windows this works fine.
----- code begin -----------
WNDCLASS wc;
HWND hWineTest2Wnd;
HDC hWineTest2WndDC;
HFONT hFont, hOldFont;
COLORREF OldTextColor;
int nOldBkMode;
POINT CursorPos;
int XPosition,YPosition;
static char cszWineTest2WndCls[] = "WineTest2WndClass";
static char cszWineTest2Wnd[] = "WineTest2Wnd";
char *szTestStr = "WineTest Text";
memset( &wc, 0, sizeof( wc ) );
wc.hInstance = hInst;
wc.style = CS_OWNDC;
wc.hbrBackground = (HBRUSH)( COLOR_BACKGROUND +1 ); //Works OK
if this line is removed
wc.lpszClassName = (LPSTR)cszWineTest2WndCls;
wc.lpfnWndProc = (WNDPROC)DefWindowProc;
if ( !RegisterClass( &wc ) )
return NULL;
GetCursorPos( &CursorPos );
XPosition = CursorPos.x;
YPosition = CursorPos.y;
hWineTest2Wnd = CreateWindow( (LPCTSTR)cszWineTest2WndCls,
(LPCTSTR)cszWineTest2Wnd,
WS_POPUPWINDOW,
(
XPosition + 2), ( YPosition + 20 ), 250, 50,
hwndParent, 0, hInst, NULL );
if ( !hWineTest2Wnd ) {
UnregisterClass( (LPSTR)cszWineTest2WndCls, hInst );
return NULL;
}
hFont = (HFONT)GetStockObject( DEFAULT_GUI_FONT );
hWineTest2WndDC = GetDC( hWineTest2Wnd );
hOldFont = (HFONT)SelectObject( hWineTest2WndDC, hFont );
nOldBkMode = SetBkMode( hWineTest2WndDC, TRANSPARENT );
OldTextColor = SetTextColor( hWineTest2WndDC, RGB( 0,0,0 ) );
ShowWindow( hWineTest2Wnd, SW_SHOWNOACTIVATE );
TextOut( hWineTest2WndDC, 1, 1, (LPCTSTR)szTestStr, strlen(
szTestStr ) );
SelectObject( hWineTest2WndDC, hOldFont );
DeleteObject( hFont );
SetBkMode( hWineTest2WndDC, nOldBkMode );
ReleaseDC( hWineTest2Wnd, hWineTest2WndDC );
return hWineTest2Wnd;
----- code end --------
Igor