Skip to main content
GameDev.net gamedev.net
🔒 Locked

Compiling Error - please help.

Started by 1kevgriff Oct 10, 2000 at 1:55 PM 4 replies 250+ views
Original Post
1kevgriff
1kevgriff
Hi. I''ve been reading TWGPG by LaMothe and I been using it to start out a game I''ve been planning to do in DirectX. Well, I''ve all the code out of the book to get the main idea of how to do it and form it too my game. But at build time (I use VC 6.0) I get this error: c:\testament\testament\main.cpp(86) : error C2440: ''='' : cannot convert from ''void *'' to ''struct HBRUSH__ *'' Here is the code it comes from
    
winclass.cbSize		= sizeof(WNDCLASSEX);	
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); // ERROR(86)
winclass.lpszMenuName	= NULL;
winclass.lpszClassName	= WINDOW_CLASS_NAME;
winclass.hIconSm	= LoadIcon(NULL, DI_APPLICATION);
    
Any ideas would be appreciated. Thanks
OoMMMoO
OoMMMoO
You need to go

winclass.hbrBackground=(HBRUSH)GetStockObject(ect...
freeman_swe
freeman_swe
Or you could try
winclass.hbrBackground = GetStockBrush(BLACK_BRUSH);
Quantum
Quantum
its because VC6 no longer performs implicit casts on some types, as anon said, you need to use
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);

to convert it to a HBRUSH

hope this helps

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.