Win32 functions, saying thier void?

Started by
2 comments, last by RyoxSinfar 20 years ago
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?
Advertisement
I had a problem like that before with CreateFileA(). Things of type HANDLE are void*. If using C++, and using HPEN, you have to cast it to void* or HANDLE.
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.
Too old for this ...
<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

This topic is closed to new replies.

Advertisement