Tech Support > Microsoft Windows > Development Resources > Subclassing error
Subclassing error
Posted by Philipp on May 5th, 2008


Hi,

I am trying to subclass a button using the SetWindowSubclass() function but
it tells me that the 'identifier was not found'. I have included "commctl.h"
and added comctl32.lib to the linker command line. I also had a look in
comctl32.lib and found the word SetWindowSubclass. I assume this means I
have at least version 6 of the library which is required. Why would this
error still come up? What could I be doing wrong? How can I be definite of
what version of comctl32.lib I have?

Maybe I'll have to use SetWindowLongPtr()....

Thanks,

Philipp


Posted by Christian ASTOR on May 5th, 2008


Philipp wrote:

Check if your SDK headers are up-to-date (and _WIN32_WINNT)
http://www.msdn.net/archive/default....ib/default.asp
or more recents...

Posted by Philipp on May 5th, 2008


Yep they are up-to-date.
Besides, I found the SetWindowSubclass function in the commctl header
anyway...
Any ideas?

Philipp

"Christian ASTOR" <castorix@club-internet.fr> wrote in message
news:481ece51$0$21150$7a628cd7@news.club-internet.fr...


Posted by Christian ASTOR on May 5th, 2008


Philipp wrote:

is _WIN32_WINNT correctly defined (>= 0x0501) ?

Posted by Philipp on May 5th, 2008


I believe so although I am not 100% sure on how to test this. What does the
code 0x0501 represent?

"Christian ASTOR" <castorix@club-internet.fr> wrote in message
news:481ed214$0$21150$7a628cd7@news.club-internet.fr...


Posted by David Jones on May 5th, 2008


Philipp <starcatcher_2006@yahoo.com.au> wrote...
http://blogs.msdn.com/oldnewthing/ar...0/2065725.aspx
http://blogs.msdn.com/oldnewthing/ar...1/2079137.aspx

0x0501 is Windows XP. One way to test it is to use it in a conditional
compilation, such as:

#if (_WIN32_WINNT < 0x0501)
#error _WIN32_WINNT not set high enough.
#endif

Another simple check is to just search for _WIN32_WINNT in your source.
If you're never setting it anywhere, it's definitely < 0x0501.

HTH,

David

Posted by Ron Francis on May 6th, 2008


The following refers to Windows XP and VS 2005:

I gather that you have added comctl32.lib to your additional dependencies in
the linker/input section of your project's properties?
In the properties again, you can define _WIN32_WINNT=0x0501 in C/C++ /
Preprocessor / Preprocessor Definitions.

Regards,
Ron Francis
www.RonaldFrancis.com



Posted by Philipp on May 9th, 2008


Thanks for that. I tried that exactly but it STILL didn't work (I had
comctl32.lib in the wrong place but this didnt change anything). I will just
use SetWindowLongPtr().

Thanks to everyone for all the help!

Philipp

"Ron Francis" <ronfrancis@adam.com.au> wrote in message
news:fI2dnRFDyqJmUILVnZ2dnUVZ_tGonZ2d@adnap.net.au ...



Similar Posts