Thread: Dialog Box & Property Sheet :: MFC

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348

    Dialog Box & Property Sheet :: MFC

    Hi. I have some fundamental questions about dialog box and property sheet. Most ultimately have to do with program design and memory management.

    Dialog Box:

    Is the following good program design?

    -----
    MyBox mBox;

    if (mBox.DoModal == IDOK)

    // Is it good program design to get data from a dialog box after it has been closed/distroyed?

    DataType = mBox.GetData();
    -----

    Dialog Box & Property Sheet:

    What do you think about declare all dialog box and/or property sheets as private data member rather than local data member?

    In general, I want to make sure there is not memory leak with dealing with dialog box and/or property sheet and local data members.

    Thanks,
    Kuphryn

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    223

    data from property sheet or dialog

    When destroyed you should not be able to retrieve data period. However after returning from .DoModal() you usually can. However, you cannot perform operations such as GetWindowText and the Like because the window has been destroyed although the object remains... The object is created when declared although the window is create upon calling Create or Domodal the object therefore remains after the window is destroyed and any data within it should be retrieve through member variables.
    zMan

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Okay. Thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. How to program a "back" button with MFC
    By 99atlantic in forum Windows Programming
    Replies: 3
    Last Post: 04-26-2005, 08:34 PM
  3. New Theme
    By XSquared in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Property Sheets :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 05-09-2002, 03:04 PM