user32: HGDIOBJ is interchangeable with other handle types; no casts are needed.

This commit is contained in:
Michael Stefaniuc 2008-10-25 23:39:12 +02:00 committed by Alexandre Julliard
parent 092b892f54
commit 4fc84eaf5a
7 changed files with 41 additions and 41 deletions

View File

@ -812,8 +812,8 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
setup_clipping( hwnd, hDC );
hOldPen = (HPEN)SelectObject(hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
hOldBrush =(HBRUSH)SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
hOldPen = SelectObject(hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
hOldBrush = SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
oldBkMode = SetBkMode(hDC, TRANSPARENT);
if (get_button_type(style) == BS_DEFPUSHBUTTON)

View File

@ -709,7 +709,7 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style )
}
if ((hFont = (HFONT)GetWindowLongPtrW( hwnd, HFONT_GWL_OFFSET )))
hOldFont = (HFONT)SelectObject( hdc, hFont );
hOldFont = SelectObject( hdc, hFont );
/* SS_SIMPLE controls: WM_CTLCOLORSTATIC is sent, but the returned
brush is not used */

View File

@ -797,7 +797,7 @@ static BOOL RegisterTestDialog(HINSTANCE hInstance)
wcx.hInstance = hInstance;
wcx.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wcx.hCursor = LoadCursor(NULL, IDC_ARROW);
wcx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wcx.hbrBackground = GetStockObject(WHITE_BRUSH);
wcx.lpszClassName = "TestDialog";
wcx.lpszMenuName = "TestDialog";
wcx.hIconSm = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(5),

View File

@ -5059,7 +5059,7 @@ static void test_button_messages(void)
ok_sequence(WmLButtonUpSeq, "WM_LBUTTONUP on a button", FALSE);
flush_sequence();
zfont = (HFONT)GetStockObject(SYSTEM_FONT);
zfont = GetStockObject(SYSTEM_FONT);
SendMessageA(hwnd, WM_SETFONT, (WPARAM)zfont, TRUE);
UpdateWindow(hwnd);
ok_sequence(WmSetFontButtonSeq, "WM_SETFONT on a button", FALSE);

View File

@ -112,7 +112,7 @@ START_TEST(static)
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
wndclass.lpszClassName = szClassName;
wndclass.lpszMenuName = NULL;
RegisterClassEx(&wndclass);

View File

@ -1169,13 +1169,13 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb, GRAYSTRINGPROC fn, LPARAM lp, IN
if (!(memdc = CreateCompatibleDC(hdc))) return FALSE;
hbm = CreateBitmap(cx, cy, 1, 1, NULL);
hbmsave = (HBITMAP)SelectObject(memdc, hbm);
hbmsave = SelectObject(memdc, hbm);
hbsave = SelectObject( memdc, GetStockObject(BLACK_BRUSH) );
PatBlt( memdc, 0, 0, cx, cy, PATCOPY );
SelectObject( memdc, hbsave );
SetTextColor(memdc, RGB(255, 255, 255));
SetBkColor(memdc, RGB(0, 0, 0));
hfsave = (HFONT)SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT));
hfsave = SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT));
retval = fn(memdc, lp, slen);
SelectObject(memdc, hfsave);
@ -1189,12 +1189,12 @@ static BOOL TEXT_GrayString(HDC hdc, HBRUSH hb, GRAYSTRINGPROC fn, LPARAM lp, IN
if(retval || len != -1)
#endif
{
hbsave = (HBRUSH)SelectObject(memdc, SYSCOLOR_55AABrush);
hbsave = SelectObject(memdc, SYSCOLOR_55AABrush);
PatBlt(memdc, 0, 0, cx, cy, 0x000A0329);
SelectObject(memdc, hbsave);
}
if(hb) hbsave = (HBRUSH)SelectObject(hdc, hb);
if(hb) hbsave = SelectObject(hdc, hb);
fg = SetTextColor(hdc, RGB(0, 0, 0));
bg = SetBkColor(hdc, RGB(255, 255, 255));
BitBlt(hdc, x, y, cx, cy, memdc, 0, 0, 0x00E20746);

View File

@ -141,8 +141,8 @@ static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc,
+ (LTRBOuterMono[uType & (BDR_INNER|BDR_OUTER)] != -1 ? 1 : 0);
/* Init some vars */
OuterPen = InnerPen = (HPEN)GetStockObject(NULL_PEN);
SavePen = (HPEN)SelectObject(hdc, InnerPen);
OuterPen = InnerPen = GetStockObject(NULL_PEN);
SavePen = SelectObject(hdc, InnerPen);
spx = spy = epx = epy = 0; /* Satisfy the compiler... */
/* Determine the colors of the edges */
@ -337,8 +337,8 @@ static BOOL UITOOLS95_DrawDiagEdge(HDC hdc, LPRECT rc,
HPEN hpsave;
HPEN hp = SYSCOLOR_GetPen(uFlags & BF_MONO ? COLOR_WINDOW
: COLOR_BTNFACE);
hbsave = (HBRUSH)SelectObject(hdc, hb);
hpsave = (HPEN)SelectObject(hdc, hp);
hbsave = SelectObject(hdc, hb);
hpsave = SelectObject(hdc, hp);
Polygon(hdc, Points, 4);
SelectObject(hdc, hbsave);
SelectObject(hdc, hpsave);
@ -453,8 +453,8 @@ static BOOL UITOOLS95_DrawRectEdge(HDC hdc, LPRECT rc,
&& !(uFlags & (BF_FLAT|BF_MONO)) );
/* Init some vars */
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = (HPEN)GetStockObject(NULL_PEN);
SavePen = (HPEN)SelectObject(hdc, LTInnerPen);
LTInnerPen = LTOuterPen = RBInnerPen = RBOuterPen = GetStockObject(NULL_PEN);
SavePen = SelectObject(hdc, LTInnerPen);
/* Determine the colors of the edges */
if(uFlags & BF_MONO)
@ -778,7 +778,7 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
if((uFlags & 0xff) == DFCS_BUTTONRADIOMASK)
{
hbsave = (HBRUSH)SelectObject(dc, GetStockObject(BLACK_BRUSH));
hbsave = SelectObject(dc, GetStockObject(BLACK_BRUSH));
Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
SelectObject(dc, hbsave);
}
@ -786,16 +786,16 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
{
if(uFlags & (DFCS_FLAT|DFCS_MONO))
{
hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_WINDOWFRAME));
hpsave = SelectObject(dc, SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
hbsave = SelectObject(dc, GetSysColorBrush(COLOR_WINDOWFRAME));
Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
SelectObject(dc, hbsave);
SelectObject(dc, hpsave);
}
else
{
hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(COLOR_BTNHIGHLIGHT));
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
hpsave = SelectObject(dc, SYSCOLOR_GetPen(COLOR_BTNHIGHLIGHT));
hbsave = SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
Pie(dc, myr.left, myr.top, myr.right+1, myr.bottom+1, myr.left-1, myr.bottom, myr.right+1, myr.top);
SelectObject(dc, SYSCOLOR_GetPen(COLOR_BTNSHADOW));
@ -824,8 +824,8 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
myr.top = yc - i+i/2;
myr.bottom = yc + i/2;
i= !(uFlags & (DFCS_INACTIVE|DFCS_PUSHED)) ? COLOR_WINDOW : COLOR_BTNFACE;
hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(i));
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
hpsave = SelectObject(dc, SYSCOLOR_GetPen(i));
hbsave = SelectObject(dc, GetSysColorBrush(i));
Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
SelectObject(dc, hbsave);
SelectObject(dc, hpsave);
@ -841,8 +841,8 @@ static BOOL UITOOLS95_DFC_ButtonRadio(HDC dc, LPRECT r, UINT uFlags)
myr.bottom = yc + i/2;
i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_WINDOWTEXT;
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(i));
hbsave = SelectObject(dc, GetSysColorBrush(i));
hpsave = SelectObject(dc, SYSCOLOR_GetPen(i));
Ellipse(dc, myr.left, myr.top, myr.right, myr.bottom);
SelectObject(dc, hpsave);
SelectObject(dc, hbsave);
@ -930,7 +930,7 @@ static BOOL UITOOLS95_DrawFrameCaption(HDC dc, LPRECT r, UINT uFlags)
alignsave = SetTextAlign(dc, TA_TOP|TA_LEFT);
bksave = SetBkMode(dc, TRANSPARENT);
clrsave = GetTextColor(dc);
hfsave = (HFONT)SelectObject(dc, hf);
hfsave = SelectObject(dc, hf);
GetTextExtentPoint32W(dc, str, 1, &size);
if(uFlags & DFCS_INACTIVE)
@ -1013,8 +1013,8 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
case DFCS_SCROLLSIZEGRIP:
/* This one breaks the flow... */
UITOOLS95_DrawRectEdge(dc, r, EDGE_BUMP, BF_MIDDLE | ((uFlags&(DFCS_MONO|DFCS_FLAT)) ? BF_MONO : 0));
hpsave = (HPEN)SelectObject(dc, GetStockObject(NULL_PEN));
hbsave = (HBRUSH)SelectObject(dc, GetStockObject(NULL_BRUSH));
hpsave = SelectObject(dc, GetStockObject(NULL_PEN));
hbsave = SelectObject(dc, GetStockObject(NULL_BRUSH));
if(uFlags & (DFCS_MONO|DFCS_FLAT))
{
hp = hp2 = SYSCOLOR_GetPen(COLOR_WINDOWFRAME);
@ -1099,8 +1099,8 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
if(uFlags & DFCS_INACTIVE)
{
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(COLOR_BTNHIGHLIGHT));
hbsave = SelectObject(dc, GetSysColorBrush(COLOR_BTNHIGHLIGHT));
hpsave = SelectObject(dc, SYSCOLOR_GetPen(COLOR_BTNHIGHLIGHT));
Polygon(dc, Line, 3);
SelectObject(dc, hpsave);
SelectObject(dc, hbsave);
@ -1114,8 +1114,8 @@ static BOOL UITOOLS95_DrawFrameScroll(HDC dc, LPRECT r, UINT uFlags)
}
i = uFlags & DFCS_INACTIVE ? COLOR_BTNSHADOW : COLOR_BTNTEXT;
hbsave = (HBRUSH)SelectObject(dc, GetSysColorBrush(i));
hpsave = (HPEN)SelectObject(dc, SYSCOLOR_GetPen(i));
hbsave = SelectObject(dc, GetSysColorBrush(i));
hpsave = SelectObject(dc, SYSCOLOR_GetPen(i));
Polygon(dc, Line, 3);
SelectObject(dc, hpsave);
SelectObject(dc, hbsave);
@ -1147,8 +1147,8 @@ static BOOL UITOOLS95_DrawFrameMenu(HDC dc, LPRECT r, UINT uFlags)
FillRect(dc, r, (HBRUSH)GetStockObject(WHITE_BRUSH));
hbsave = (HBRUSH)SelectObject(dc, GetStockObject(BLACK_BRUSH));
hpsave = (HPEN)SelectObject(dc, GetStockObject(BLACK_PEN));
hbsave = SelectObject(dc, GetStockObject(BLACK_BRUSH));
hpsave = SelectObject(dc, GetStockObject(BLACK_PEN));
switch(uFlags & 0xff)
{
@ -1539,7 +1539,7 @@ static BOOL UITOOLS_DrawStateJam( HDC hdc, UINT opcode, DRAWSTATEPROC func, LPAR
case DST_BITMAP:
memdc = CreateCompatibleDC(hdc);
if(!memdc) return FALSE;
hbmsave = (HBITMAP)SelectObject(memdc, (HBITMAP)lp);
hbmsave = SelectObject(memdc, (HBITMAP)lp);
if(!hbmsave)
{
DeleteDC(memdc);
@ -1662,7 +1662,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp
if(!hbm) goto cleanup;
memdc = CreateCompatibleDC(hdc);
if(!memdc) goto cleanup;
hbmsave = (HBITMAP)SelectObject(memdc, hbm);
hbmsave = SelectObject(memdc, hbm);
if(!hbmsave) goto cleanup;
rc.left = rc.top = 0;
rc.right = cx;
@ -1670,7 +1670,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp
if(!FillRect(memdc, &rc, (HBRUSH)GetStockObject(WHITE_BRUSH))) goto cleanup;
SetBkColor(memdc, RGB(255, 255, 255));
SetTextColor(memdc, RGB(0, 0, 0));
hfsave = (HFONT)SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT));
hfsave = SelectObject(memdc, GetCurrentObject(hdc, OBJ_FONT));
/* DST_COMPLEX may draw text as well,
* so we must be sure that correct font is selected
@ -1683,7 +1683,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp
/* This state cause the image to be dithered */
if(flags & DSS_UNION)
{
hbsave = (HBRUSH)SelectObject(memdc, SYSCOLOR_55AABrush);
hbsave = SelectObject(memdc, SYSCOLOR_55AABrush);
if(!hbsave) goto cleanup;
tmp = PatBlt(memdc, 0, 0, cx, cy, 0x00FA0089);
SelectObject(memdc, hbsave);
@ -1699,7 +1699,7 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp
if (flags & (DSS_DISABLED|DSS_DEFAULT))
{
if(!hbrtmp) goto cleanup;
hbsave = (HBRUSH)SelectObject(hdc, hbrtmp);
hbsave = SelectObject(hdc, hbrtmp);
if(!hbsave) goto cleanup;
if(!BitBlt(hdc, x+1, y+1, cx, cy, memdc, 0, 0, 0x00B8074A)) goto cleanup;
SelectObject(hdc, hbsave);
@ -1714,10 +1714,10 @@ static BOOL UITOOLS_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp
}
else if (!hbr)
{
hbr = (HBRUSH)GetStockObject(BLACK_BRUSH);
hbr = GetStockObject(BLACK_BRUSH);
}
hbsave = (HBRUSH)SelectObject(hdc, hbr);
hbsave = SelectObject(hdc, hbr);
if(!BitBlt(hdc, x, y, cx, cy, memdc, 0, 0, 0x00B8074A)) goto cleanup;