Thread: Modal Dialogs?

  1. #1
    Caffienated jinx's Avatar
    Join Date
    Oct 2001

    Question Modal Dialogs?

    Is there any way to get a CString from a modal dialog box? First off, how do you intialize the modal dialog box. In case you haven't yet picked up, this is for MFC, more over, an SDI app.
    Thanks for any help.

  2. #2
    Registered User
    Join Date
    Nov 2001
    You could try using DDX to retrieve the value from the dialog. If you go to the actual dialog in the resource folder and then open up class wizard you select the ID of the editbox on the dialog where your CString value will be entered by the user and you can then add a CString member variable that would hold the value entered in the dialog box. Once the dialog box is displayed, the value entered, and the OK button clicked, DDX will ensure that the value entered will be sent to the corresponding variable in your dialog class.

    You must remember to create an instance of your dialog and then call on the domodal function to display it. If the dialog is displayed in response to a menu button being clicked you would have to place the code in the message handler for that menu button.

    For instance if the dialog class is called CDlg, we would have:

    CDlg exampledlg;

    For more detail you can check the MSDN library it has some really useful information. Hope this helps.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing parameters to modal dialogs
    By Halloko in forum Windows Programming
    Replies: 2
    Last Post: 10-11-2005, 07:15 AM
  2. Modeless Dialogs in Multiple threads
    By MrGrieves in forum Windows Programming
    Replies: 0
    Last Post: 06-22-2004, 01:33 PM
  3. Non modal Dialogs
    By Barjor in forum Windows Programming
    Replies: 3
    Last Post: 02-08-2002, 11:50 AM
  4. Getting Modal text in and SDI app.
    By jinx in forum Windows Programming
    Replies: 3
    Last Post: 11-23-2001, 12:01 PM
  5. modal average
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 11-01-2001, 01:18 PM