FillRect with WHITE_BRUSH fails on WinCE 6.0
I'm attempting to clear part of my screen with
FillRect(hdc, &r, (HBRUSH)(WHITE_BRUSH))
However it "succeeds" (returns nonzero) but writes nothing to the screen. If I change it to
FillRect(hdc, &r, (HBRUSH)开发者_JAVA技巧(WHITE_BRUSH+1))
it magically starts working, except now it's clearing the screen with a slight gray color. Is there something I am missing here?
The brush constants are not guaranteed to be valid handles; you're supposed to use GetStockObject
to convert the constant to a handle. It's probably just a coincidence that WHITE_BRUSH+1
evaluates to something that appears to work.
精彩评论