Thread: Dialog Display

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937

    Dialog Display

    I have the class. It's built. I'm using MSVC++. I'm using MFC. How do I display my new dialog box? What do I call?
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    int result;
    YourDialogClass dlg;

    result = dlg.DoModal();
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User ski6ski's Avatar
    Join Date
    Aug 2001
    Posts
    133
    Have you seen this?
    Code:
    CAboutDlg dlgAbout;
    dlgAbout.DoModal();
    This is where the About dialog is called. But on to your question. Luckily I have this from the old Message board.
    By an anonymous person:

    Create a class for the dialog box.
    Ex If the name of the dialog is "CMyDialog",

    In the mainframe create button in the drop down menus and then add a function for the button.

    In the function construct a CMyDialog object.
    Ex. CMyDialog dlg;

    Then call DoModal();

    dlg.DoModal();

    Remember to include the header file for the dialog in the mainframe class......
    #include "MyDialog.h"

    So if you created a button with a caption of "Test" then the function for Left Buttohn clicked to bring up the dialog will be

    CMainFrame::OnTest()
    {
    CMyDialog dlg;
    dlg.DoModal();
    }
    C++ Is Powerful
    I use C++
    There fore I am Powerful

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 20
    Last Post: 02-23-2010, 01:49 AM
  2. Display Color dialog
    By Cherry65 in forum Windows Programming
    Replies: 4
    Last Post: 02-17-2009, 11:41 AM
  3. Display text in a Dialog Box
    By Dark_Phoenix in forum Windows Programming
    Replies: 9
    Last Post: 01-02-2009, 06:30 AM
  4. Display Dialog Box Then Execute
    By stickman in forum C++ Programming
    Replies: 17
    Last Post: 05-10-2006, 11:02 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM