Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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?

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

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.
Share this answer
AndrewG1231 15-Jun-11 19:20pm    

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