VC++ trouble...
This weekend, I started learning how to code in Visual C++ 6.0, but I've already got stuck because the compiler refuse to accept the following line of code:
( WNDCLASS window_class; )
window_class.hbrBackground = GetStockObject(BLACK_BRUSH);
This is the error message:
error C2440: '=' : cannot convert from 'void *' to 'struct HBRUSH__ *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
I hope someone can come up with a good solution!
// Mazen
Edited by - Mazen on 10/28/00 5:50:05 PM
"We paint the sky with blood tonight, setting free the damned to fight"
October 28, 2000 06:03 PM
The only thing you have to do is cast it as an HBRUSH
window_class.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
window_class.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
October 28, 2000 06:05 PM
Also, the reason is because GetStockObject() returns an HGDIOBJ, which is a handle to a GDI object. This object can be a brush, a bitmap, a font, a region, or a pen.
Thanks!
"We paint the sky with blood tonight, setting free the damned to fight"
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement