WndClass.hbrBackground = GetStockObject(WHITE_BRUSH); //and I made it WndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);