It most certainly is:
error C2440: '=' : cannot convert from 'void *' to 'struct HBITMAP__ *'
Conversion from 'void*' to pointer to non-'void' requires an explicit cast
and msdn says:Compiler Error C2440
'conversion' : cannot convert from 'type1' to 'type2'
The compiler was unable to cast from ‘type1’ to ‘type2.’
Which seems fairly explicit and clear on the point.
eg try:
Code:
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(hwnd,&ps);
HBITMAP farty=SelectObject(ps.hdc,0);
EndPaint(hwnd,&ps);
return 0;
}
and compilation fails with error C2440 as originally reported. Replace it with:
Code:
case WM_PAINT:
{
PAINTSTRUCT ps;
BeginPaint(hwnd,&ps);
HBITMAP farty=(HBITMAP)SelectObject(ps.hdc,0);
EndPaint(hwnd,&ps);
return 0;
}
and no more errors, clean compile.
Novocaine: What version of msvc are you using? I recall not having to cast these things with msvc5. Or perhaps you are using a different compiler? Or is there a project setting i've missed? I don't mean to be a hassle, i'm just curious in case i've missed something...