Archived

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

origil

A probably simple windows API problem

Recommended Posts

origil    134
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   
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
arunvb    147
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
origil    134
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