Click here to Skip to main content
13,632,371 members
Rate this:
 
Please Sign up or sign in to vote.
I am trying to figure out how to add functionality to my menu resource in VS2010 and I am not sure how to program it so when the user clicks 'New' it will display a dialog box. I know if I use the following code I can generate a message box.
<pre lang="cs">void MFC_Tutorial_Window::OnFileNew()
{
    MessageBox("Clicked File->New");
}



Will the same type of thing work for a dialog box and DoModal?

Thanks!
Posted 15-Jun-11 8:11am
Comments
TRK3 15-Jun-11 14:27pm
   
Try it. Then submit your question if you still have one.
AndrewG1231 15-Jun-11 19:20pm
   
It worked, thanks!

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

When a menu item is clicked your program will receive a WM_COMMAND message with parameters that identifies which menu item was selected. What you do at that point can be anything from showing a MessageBox(), as you did here, to anything that your imagination can conjure up.
  Permalink  
Comments
AndrewG1231 15-Jun-11 19:20pm
   
Thanks!

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
Web03-2016 | 2.8.180712.1 | Last Updated 15 Jun 2011
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

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