Need help whit C++ code..
what is wrong,, i get this error message:
-----Configuration: noname - Win32 Debug--------------------
Compiling...
noname.cpp
c:\cpp\temp\noname.cpp(86) : error C2440: ''='' : cannot convert from ''void *'' to ''struct HBRUSH__ *''
Conversion from ''void*'' to pointer to non-''void'' requires an explicit cast
Error executing cl.exe.
noname.exe - 1 error(s), 0 warning(s)
..... heres some code from that lines(winmain)..::
// WINMAIN
int WINAPI WinMain(HINSTANCE hinstance,
HINSTANCE hprevinstance,
LPSTR lpcmdline,
int ncmdshow)
{
WNDCLASS winclass;
HWND hwnd;
MSG msg;
winclass.style = CS_DBLCLKS / CS_OWNDC /
CS_HREDRAW / CS_VREDRAW;
winclass.lpfnWndProc = WindowProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hinstance;
winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
winclass.hCursor = LoadCursor(NULL, IDC_ARROW);
winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
^^^^ this line gives error ^^^^^^^^^^^^^^^^^^^^^^^^^^^
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME;
if(!RegisterClass(&winclass))
return(0);
if(!(hwnd = CreateWindow(WINDOW_CLASS_NAME,
"noname", // titel
WS_OVERLAPPEDWINDOW / WS_VISIBLE,
0,0, // x,y startposition
320,200, // bredd, höjd
NULL, // handtag till moder
NULL, // handtag till meny
hinstance,
NULL)))
return(0);
main_window_handle = hwnd;
Init();
while(1)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if(msg.message == WM_QUIT) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Main();
}
Shutdown();
return(msg.wParam);
}
//==========================================================
(sorry for the swedish comments)
this code worked in borland c++ 5,, but now im trying to use MS-VC++,, It is possible i have some bad option or setting somewhere who coussing this.. plz hlp, tnx..
// dha^zynd!kate
// dha^zynd!kate
just cast the void* to a HBRUSH
winclass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
winclass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
Rid''s right. You looking at some of LaMothe''s books? That''s how it shows you to do it in there, but that''s for VC++ 5.0. If you have 6.0 you gotta do it as was mentioned.
If you code it, they will come...
Commander M
http://commanderm.8m.com
cmndrm@commanderm.8m.com
If you code it, they will come...
Commander M
http://commanderm.8m.com
cmndrm@commanderm.8m.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement