Archived

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

PPCThug

HBRUSH casting problem

Recommended Posts

PPCThug    130
I am learning C++. I was making a win32 program in VC++ 6.0 introductory edition, when I built/compiled the program I got several errors, this is the only one I couldn't figure out. C:\Program Files\Microsoft Visual Studio\MyProjects\awindow1\awindow.cpp(61) : error C2440: '=' : cannot convert from 'void *' to 'struct HBRUSH__ *' Conversion from 'void*' to pointer to non-'void' requires an explicit cast winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path. Edited by - felisandria on January 30, 2002 3:53:52 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
I think you got to cast it with (HBRUSH). So..


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

Share this post


Link to post
Share on other sites
PPCThug    130
after a little searching I found that it was a typo which was fixed in the demo on the CD but not in the book! Thanks!

PS- did some one change the title of my thread? not that I mind, it just confused me for a short while.



the Particle Projection Cannon fires a shimmering blue bolt, much like a cross between lightning and a sine wave that ripples along its path.

Share this post


Link to post
Share on other sites