ok, one last question: if my base class has a static wndproc which then calls a virtual wndproc, how does my derived class use a wndproc? i mean, does it override the static or virtual wndproc, and how should it itself be declared?
ok, one last question: if my base class has a static wndproc which then calls a virtual wndproc, how does my derived class use a wndproc? i mean, does it override the static or virtual wndproc, and how should it itself be declared?
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
>>how does my derived class use a wndproc? i mean, does it override the static or virtual wndproc, and how should it itself be declared?<<
In your static wndproc you cast this to your base class pointer which has the virtual wndproc. In each derived class that needs one you declare and define that virtual wndproc (you only need to declare it virtual once but it's clearer, to me anyway, to repeat the virtual keyword in derived class wndprocs).
The reason you have a virtual fn is because it can be overriden in derived classes; the static wndproc is, as the name implies, 'static'.
Whichever virtual fn is currently in scope gets called but you can override this by using scope resolution ie 'BaseClass::VirtualWndProc' rather than just 'VirtualWndProc' but only if you need to.
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.