Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC menu dialog display
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 6-Jun-11 8:40am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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!
  Permalink  
Comments
Albert Holguin at 3-Jul-11 22:43pm
   
Don't post updates as solutions... update the question or comment under solutions

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

  Print Answers RSS
0 OriginalGriff 6,696
1 Sergey Alexandrovich Kryukov 6,675
2 CPallini 5,315
3 George Jonsson 3,584
4 Gihan Liyanage 2,650


Advertise | Privacy | Mobile
Web02 | 2.8.140921.1 | Last Updated 12 Jun 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100