Archived

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

Guest Anonymous Poster

trouble here...

This topic is 6585 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

Not sure why you got this in 6 and not 5, but you should just be able to cast it:

winclass.hbrBackground = reinterpret_cast<HBRUSH *>(GetStockObject(DKGRAY_BRUSH));

Mason McCuskey
Spin Studios
www.spin-studios.com

[This message has been edited by mason (edited December 03, 1999).]

[This message has been edited by mason (edited December 03, 1999).]

Share this post


Link to post
Share on other sites
i don't think you need all that reinterpret_cast<> stuff, all you need to do is

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

GetStockObject just returns a void pointer to some memory, and you need to tell the compiler to cast it into the HBRUSH class for the background of your window

------------------

_________________Gecko___

Share this post


Link to post
Share on other sites
Thats one of the big differences between vs5 and vs6. 5 was more forgiving with mixing types, which didnt really follow standards.

Misuse of the reinterpret_cast operator can easily be unsafe. (and not as easy to read) Unless the desired conversion is inherently low-level, you should use one of the other cast operators.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hi!

I've converted an old game project from MSVC 5.0 to 6.0....when i try to compile the whole thing i get an error on this line of code:

winclass.hbrBackground = GetStockObject(DKGRAY_BRUSH);

the error is:
cannot convert from 'void *' to 'struct HBRUSH__ *'

what is the problem???

Thanks in advance.

Share this post


Link to post
Share on other sites