-
Subclassing
I have seen many programs do subclassing, but i dont really get it. What would I need exactly? an extra WndProc separate from the rest? in the programs(ssubtimer), there is an extra wndproc empty, in a separate module and another with a call to a few functions. i dont understand what the empty one does. thanks
-
Is the "empty" wndproc such a thing?
If yes, this is because when subclassing, you still need to allow the window to process it's messages via it's original wndproc. What is declared here is a pointer to a function - it is used to save the position of the old wndproc. In the new wndproc, you don't call DefWindowProc, but rather use CallWindowProc(pOldWP, ...) to call the window's original wp.
-
cool..thanks...cornedbee.. :)
-
...
hey corned bee, i have a question:
i am gonna start working on a COMponent for cool menus, and so I am gonna hve to subclass at one point..do you think i should have the subclassing part in a dll, or separate header, or even in the component, implemented within the component? cuz i am not going to use subclassing only for menus..let's say i have another project that needs it? i thought it would be good to have everything incorporated into one nice and compact COMponent(in a dll form), but then what if i wanna do some more subclassing? maybe i could even rewrite the code for subclassing when i need it, right? anyways, just needed some advice from someone with more experience than me..
thanks
-
I've never done COM before, but I read about the system. Your Component should be in a single dll, not more. You can create a DLL now that does what you want it to do, and later upgrade the dll if you want to add functionality. Just remember that COM requires that everything that worked before must work exactly the same way afterwards. You may never remove functoinality, or even change an existing functions parameters. You may, however, change the implementation of your object, as long as old apps made with your component still work. But still you have only one dll.
Header files do not contain object - they just make them known to the user. You can put the declarations of additional functionality into a new header.
There's another problem. I think I remember an old thread here that had to do with menu subclassing - I don't think we found a way to get the hwnd of the menu...