Click here to Skip to main content
14,733,348 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi I'm working on an SDI View Architecture MFC application and I need to display an external dialog box when the user clicks Help -> Example. So far i have my dialog box ready and I added an event handler on the Example 'button' and added
void CtestSDIApp::OnHelpExample()
{
    rulesDlg testdlg;
    testdlg.DoModal();
}

I don't seem to see where the problem is, but it doesn't work. It does compile but yeah still.

Any suggestion on what's the easiest way to display a dialog box in MFC?

thanks a lot!
Posted

The first step is to distinguish the case where your handler isn't being called from the case where the dialog box is malfunctioning.

You can put a breakpoint in the handler and see if it's hit, or put an AfxMessageBox () in there.
   
Ok it actually worked, I just had to associate it with the right .cpp file which in this case was my doc, so the same code i posted about worked.

Thanks for the help guys!
   
Comments
Albert Holguin 3-Jul-11 22:43pm
   
Don't post updates as solutions... update the question or comment under solutions
That should work just fine given that rulesDlg is a properly defined CDialog. If you post you code for rulesDlg we can probably see if there's anything wrong there.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900