Archived

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

Win32 functions, saying thier void?

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

For some reason (and this has happened a few times) when I will use a function in win32 that does something, it will SAY it is void, and yet I know it returns a value. It is now giving me an error for having another HPEN for the SelectObject function. Saying that it is a void function, and yet I have used it before and gotten a value. This has happened with other ones as well... Anyone know why? Is it an overloaded thing?

Share this post


Link to post
Share on other sites
There''s a big diff between void and void * ... SelectObject returns a pointer to the object being removed .. like when you select a pen into a DC, the old pen is returned. Since different types of GDI objects can be returned (pen, brush, font, etc), SelectObject returns a void * which you have to cast to the appropriate type.

Share this post


Link to post
Share on other sites
<pedantic>
Types declared using DECLARE_HANDLE() are void * if you are not compiling with #define STRICT. It''s also best not to think of HANDLE objects as being even related to void * but instead as their own type.
</pedantic>


Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

Share this post


Link to post
Share on other sites