Link to home
Start Free TrialLog in
Avatar of newstandard
newstandard

asked on

cant get dialog to return a value

i cant get my dialog to close and return a value. What method do i use to force the dialog to close? here is the code in my parent class. if i close the dialog using OnOK() no message box is displayed in the code below.

             mainDlg dlg;
            m_pMainWnd = &dlg;
            INT_PTR nResponse = dlg.DoModal();
            if (nResponse == IDOK)
            {
                  // TODO: Place code here to handle when the dialog is
                  //  dismissed with OK
                  AfxMessageBox("ok");
            }
            else if (nResponse == IDCANCEL)
            {
                  // TODO: Place code here to handle when the dialog is
                  //  dismissed with Cancel
                  AfxMessageBox("cancel");
            }
            else AfxMessageBox("crap");
Avatar of newstandard
newstandard

ASKER

i figured it out.... i got rid of the second line:

m_pMainWnd = &dlg;

does this have any ramifications?
ASKER CERTIFIED SOLUTION
Avatar of _nn_
_nn_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
lol, thanks :o)

Nice of you, but I feel, I shouldn't get points here. Want me to ask for "undoing" in CS ?
don't worry about it.  take the points.  they mean nothing anyways. :-)