Results 1 to 5 of 5

Thread: Subclassing

  1. #1

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    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
    Amon Ra
    The Power of Learning.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Is the "empty" wndproc such a thing?
    Code:
    WNDPROC pOldWP;
    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.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500
    cool..thanks...cornedbee..
    Amon Ra
    The Power of Learning.

  4. #4

    Thread Starter
    Hyperactive Member Amon Ra's Avatar
    Join Date
    Feb 2001
    Location
    In some cave on Uranus...
    Posts
    500

    ...

    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
    Amon Ra
    The Power of Learning.

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width