Archived

This topic is now archived and is closed to further replies.

Code Error Problem

This topic is 6028 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I get this error in VC++: c:FILE(105) : error C2440: ''='' : cannot convert from ''void *'' to ''struct HBRUSH__ *'' Conversion from ''void*'' to pointer to non-''void'' requires an explicit cast This is the code that is on that line: winclass.hbrBackground = GetStockObject(BLACK_BRUSH); Can someone help me with fixing this? If there is anymore info you need to know, tell me. ----------------------- Hail to the king, baby.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
yeh need to cast it to HBRUSH

winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);

in win32 they changed it so one function can get tons of stuff.

Share this post


Link to post
Share on other sites
I have a new prob now:

c:\FILE(44) : error C2146: syntax error : missing ';' before identifier 'lpdd4'

c:\FILE(44) : error C2501: 'LPDIRECTDRAW4' : missing storage-class or type specifiers

c:\FILE(44) : fatal error C1004: unexpected end of file found

This is on line 44:
LPDIRECTDRAW4 lpdd4 = NULL;

Yes, I have included ddraw.h.



Edited by - Squeejee on June 8, 2001 9:04:38 PM

Share this post


Link to post
Share on other sites
If you have included ddraw.h then you have the wrong version. Visual C++ ships with DirectX 3 (IIRC).

Make sure that the line in The Options->Directories->Include tab has the directory with new DX headers listed before any "standard" include dirs.

The same goes for the directory containing the libs (on that other tab, "Libraries" or whatever it''s called, don''t quite remember).

Share this post


Link to post
Share on other sites
How do I include the ddraw.lib? I added in #include ddraw.lib but it gives me this error:

c:\FILE(18) : fatal error C1083: Cannot open include file: 'ddraw.lib': No such file or directory

And I have set Options->Directories->Libary to poing to the DX8 sdk libary older.


-----------------------
Hail to the king, baby.

Edited by - Squeejee on June 9, 2001 9:28:22 AM

Share this post


Link to post
Share on other sites
tools->options->directories->include files

add the path of the include dir of the new SDK, and make sure it's at the top of the list , or MSVC will continue to use the old headers


tools->options->directories->library files
add the path to the lib dir of the new SDK


project->settings->link->object/library modules

add ddraw.lib dxguid.lib


Edited by - kvh on June 10, 2001 10:39:49 AM

Share this post


Link to post
Share on other sites