Archived

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

A probably simple windows API problem

This topic is 6116 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''m reading the book called "Tricks of the Windows Game Programming Gurus" by Andre LaMothe. Upon one of the example my compiler (Borland) had a problem with the following: WNDCLASSEX winclass; winclass.hbrBackground = GetStockObject(BLACK_BRUSH); Error: Cannot convert ''void *'' to ''HBRUSH *''. How can this be fixed?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Change the line to :

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

This typecasts the void* to HBRUSH*.

This should solve your problem.

Arun

Share this post


Link to post
Share on other sites
Change the line to :

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

This typecasts the void* to HBRUSH*.

This should solve your problem.

Arun

Share this post


Link to post
Share on other sites
I should work on type-casting I guess.
Thanks but the compiler didn't like the type-casting,
had to remove the * from the typecasting:
from
winclass.hbrBackground = (HBRUSH*)GetStockObject(BLACK_BRUSH);
to
winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
probably a typo. Thanks though.

Edited by - origil on March 17, 2001 3:11:39 PM

Share this post


Link to post
Share on other sites