Bad design for CPropertySheet

This is a discussion on Bad design for CPropertySheet within the Windows Programming forums, part of the Platform Specific Boards category; This has bugged me since I started using these handy little CWnd-derived windows. Even though you can create custom CPropertySheets ...

  1. #1
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596

    Bad design for CPropertySheet

    This has bugged me since I started using these handy little CWnd-derived windows. Even though you can create custom CPropertySheets and CPropertyPages to add to them, IMO MS screwed up bad with one part of the design.

    There isn't a way to effectively cleanup the property pages that you add to the property sheet. You would think the property sheet keeps a list or vector of pages that have been added so it can clean them up later. However, this is not the case.

    So I have to create a function inside of my derived property sheet class just for the purpose of adding pages to a list or vector. Then I call destroy when the main frame shuts down which then calls destroy for each of the pages, etc, etc.

    Why did MS do it this way? Wouldn't it make sense to create a virtual destroy function inside of CPropertySheet so that derived classes could have a way of cleaning up the memory footprint?

    MFC is awesome but could be much more. Some of it is so 'what was the designer thinking' oriented that it is quite limiting at times. A more open-ended approach would be much better for MFC. It has a lot of handy windows and classes, but many of them are so closely tied to how MS wants you to use them, that they really stifle creativity. MS needs to learn that not every application is going to use these classes for the exact purposes they intended and provide mechanisms by which to 'step outside the box'.

    And no, .NET is not the answer I'm looking for. MFC is very good and encapsulates the API very well.
    Last edited by VirtualAce; 05-22-2006 at 02:45 AM.

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,262
    Microsoft Corporation
    1 Microsoft Way
    Redmond
    WA 98052-6399

    Seriously, word this rant the right way and maybe they'll hire you to fix it.

    I don't think MFC has ever been that high on MS's list of priorities. The API is there, it works in whatever C function-compatible language you care to name. MFC serves no purpose other than to provide programmers with something that they could've come up with on their own given time. And time being the great constraint of business-oriented development, it is oft used. That doesn't mean it's technically any good, however. It just means that if you're prepared to jump through MS's hoops to fix MS's code, then you'll get along just fine. If, however, you find yourself referencing baffling code that you simply wouldn't write, then perhaps MFC isn't for you. Maybe it's time for the world to feel the burn of YFC (Your Foundation Classes).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can you still view the bios screen with a bad CPU?
    By HyperCreep in forum Tech Board
    Replies: 4
    Last Post: 12-31-2006, 05:57 PM
  2. Poker bad beats
    By PJYelton in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 01-15-2005, 10:42 PM
  3. How bad is bad
    By caroundw5h in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 11-12-2004, 08:26 AM
  4. are you bored? (interiour design questions)
    By maes in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 01-04-2004, 03:51 AM
  5. data loss bad bad bad
    By RoD in forum Tech Board
    Replies: 4
    Last Post: 05-01-2003, 12:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21