GetClassInfo problem solved

Riccardo Cohen rcohen at articque.com
Tue Mar 4 23:48:05 PST 2008


For those who use win->GetClassInfo(); on wxWindow subclasses, be very 
carefull on MS windows

I had a wxPanel subclass whose win->GetClassInfo(); returned wxPanel's 
one instead of my subclass one. There was no compilation problem, and it 
worked perfecly with GCC, but microsoft didn't seem to call the good 
virtual function. I couldn't reproduce on a little sample, it did that 
only in my big projet...

I finally found (by chance) that adding this :

#undef GetClassInfo

after all includes, 1) in the header, and 2) in the cpp, did change 
something : wx macros DECLARE_CLASS & IMPLEMENT_CLASS are building a new 
function in your class : GetClassInfo(), but because of Microsoft macro 
#define GetClassInfo GetClassInfoA !!! it changes its name ...

undef it and it works.

(maybe a little word in the doc of rtti overview would be nice ?)

Thank you for your attention :)


-- 
Très cordialement,

Riccardo Cohen
-------------------------------------------
Articque
http://www.articque.com
149 av Général de Gaulle
37230 Fondettes - France
tel : 02-47-49-90-49
fax : 02-47-49-91-49





More information about the wx-users mailing list