Click here to Skip to main content
13,904,127 members
Rate this:
Please Sign up or sign in to vote.
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
<pre lang="cs"><br />
void CtestSDIApp::OnHelpExample()<br />
{<br />
    rulesDlg testdlg;<br />
    testdlg.DoModal();<br />
}</pre><br />

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190306.1 | Last Updated 12 Jun 2011
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

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