cant get dialog to return a value

newstandard
newstandard used Ask the Experts™
on
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");
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

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

m_pMainWnd = &dlg;

does this have any ramifications?
Commented:
None that I know of.

At first, I was worried about the "INT_PTR" and I thought that if it was a "pointer to an int", then it would be very ugly. But I realized that it could also be some kind of 32 bits quantity that you can treat as pointer or int, without having the compiler complaining at every line. Am I right or am I right ? =)

Wait... actually yes, it has one ramification : since you've figured it out yourself, you'll have to ask for a delete+refund in the Community Support area. If you hadn't posted in the thread, you would have had the option to delete. Too late now ;o)

Commented:
lol, thanks :o)

Nice of you, but I feel, I shouldn't get points here. Want me to ask for "undoing" in CS ?

Author

Commented:
don't worry about it.  take the points.  they mean nothing anyways. :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial