Creating a menu for an MFC Application

Continuing my efforts to understand how to use Visual C++ (in Visual Studio 
2008) to create a Windows application, I've come as far as creating a menu. 
I haven't been able to find a book that covers the current version of Visual 
C++, so am using an older book about Version 4 for general guidance.

I've created a menu. At that stage, the book says to associate the menu with 
a class (using the Class Wizard). The method described doesn't apply to the 
new version of C++. So far, I haven't been able to find how to associate a 
menu with a class. Can anyone provide some help?

Thanks.

Gordon P. 

0
gpadwick (21)
10/2/2008 9:38:53 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
450 Views

Similar Articles

[PageSpeed] 3

In the menu resource editor, just right click on a menu item and select Add 
Event Handler. One of the options will be which class will handle the 
command, but it will be limited to the classes associated with your main 
window and documents and the like.

-- 
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"Gordon Padwick" <gpadwick@earthlink.net> wrote in message 
news:OMH0FdNJJHA.5696@TK2MSFTNGP06.phx.gbl...
> Continuing my efforts to understand how to use Visual C++ (in Visual 
> Studio 2008) to create a Windows application, I've come as far as creating 
> a menu. I haven't been able to find a book that covers the current version 
> of Visual C++, so am using an older book about Version 4 for general 
> guidance.
>
> I've created a menu. At that stage, the book says to associate the menu 
> with a class (using the Class Wizard). The method described doesn't apply 
> to the new version of C++. So far, I haven't been able to find how to 
> associate a menu with a class. Can anyone provide some help?
>
> Thanks.
>
> Gordon P. 

0
jwood (1292)
10/2/2008 10:00:43 PM
Thanks for the helpful hint. I'll follow what you suggest.

Gordon P.

"Jonathan Wood" <jwood@softcircuits.com> wrote in message 
news:u9R$epNJJHA.4716@TK2MSFTNGP04.phx.gbl...
> In the menu resource editor, just right click on a menu item and select 
> Add Event Handler. One of the options will be which class will handle the 
> command, but it will be limited to the classes associated with your main 
> window and documents and the like.
>
> -- 
> Jonathan Wood
> SoftCircuits Programming
> http://www.softcircuits.com
>
> "Gordon Padwick" <gpadwick@earthlink.net> wrote in message 
> news:OMH0FdNJJHA.5696@TK2MSFTNGP06.phx.gbl...
>> Continuing my efforts to understand how to use Visual C++ (in Visual 
>> Studio 2008) to create a Windows application, I've come as far as 
>> creating a menu. I haven't been able to find a book that covers the 
>> current version of Visual C++, so am using an older book about Version 4 
>> for general guidance.
>>
>> I've created a menu. At that stage, the book says to associate the menu 
>> with a class (using the Class Wizard). The method described doesn't apply 
>> to the new version of C++. So far, I haven't been able to find how to 
>> associate a menu with a class. Can anyone provide some help?
>>
>> Thanks.
>>
>> Gordon P.
> 

0
gpadwick (21)
10/3/2008 2:51:22 AM
It hasn't changed at all.  It worked the same in VS4.2 as it does in VS2008, and
everything in between.  So I'm not sure what the problem is, because the way the
association is done is by the AppWizard when the app is constructed.   If you use the
AppWizard, you get the menu free when you create the app, and the association, done
through the CMultiDocTemplate, is built in.

The way this is done for additional views is to create a document template for the view
(note that you do not need to call AddDocTemplate), associating it with a child frame and
the same document as the main view, and for the IDR_ value you will create an icon, menu,
and document description string for the new view.  This has not changed since VS4.2. There
was no automated way to do this in VS4.2 and there is no automated way to do this in
VS2008. 
				joe

On Thu, 2 Oct 2008 14:38:53 -0700, "Gordon Padwick" <gpadwick@earthlink.net> wrote:

>Continuing my efforts to understand how to use Visual C++ (in Visual Studio 
>2008) to create a Windows application, I've come as far as creating a menu. 
>I haven't been able to find a book that covers the current version of Visual 
>C++, so am using an older book about Version 4 for general guidance.
>
>I've created a menu. At that stage, the book says to associate the menu with 
>a class (using the Class Wizard). The method described doesn't apply to the 
>new version of C++. So far, I haven't been able to find how to associate a 
>menu with a class. Can anyone provide some help?
>
>Thanks.
>
>Gordon P. 
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
10/15/2008 1:16:14 PM
Reply:

Similar Artilces:

how do I create 2 histograms
How do I create 2 histograms in excel Jon Peltier has instructions for creating histograms: http://www.peltiertech.com/Excel/Charts/Histograms.html Nina wrote: > How do I create 2 histograms in excel -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html ...

how do i create an association in folders option control panel to.
i am trying to view an email attachment, also print same. each time i click to see the attachment i get a message saying: (file does not have program associated with it to perform this action , create an association in folders option control panel. ) new user. how do i do this please?? Hello alibob15, you wrote on Fri, 12 Aug 2005 01:59:03 -0700: > i am trying to view an email attachment, also print same. each time i click > to see the attachment i get a message saying: (file does not have program > associated with it to perform this action , create an association in folders ...

Deployment of MFC project
Maybe this is a stupid question, but I have to ask anyway. I'm developing some COM DLL's with MFC support (Use MFC in a shared DLL) and the time has come for deployment. I read the following on MSDN: "When you install your application DLLs and components (including the redistributable files that ship with Visual C++ .NET), it is recommended that you install them only to the applications's local folder". I thought that MFC71.dll, MSVCR71.dll and others should go to the System32 folder. Should I put them in my applications local folder insted? Because of something call...

Creating html emails, with pictures like a newletter
I want ot mail customers with newsletter emails. They will include a picture or two as well, is publisher the program to use and then send as an email? Is there a better way to do classy emails just book new zealand <justbooknewzealand@discussions.microsoft.com> was very recently heard to utter: > I want ot mail customers with newsletter emails. They will include a > picture or two as well, is publisher the program to use and then send > as an email? No. > Is there a better way to do classy emails Yes. I'm not sure of specific application names (besides the usual e...

for some reason when i deploy my C# application on windows 2003 occasionaly rdr[0].ToString() hangs where rdr is a System.Data.SqlClient.SqlDataReader. Is there a fix for this? is my visual studio.net
for some reason when i deploy my C# application on windows 2003 occasionaly rdr[0].ToString() hangs where rdr is a System.Data.SqlClient.SqlDataReader. Is there a fix for this? is my visual studio.net out dated? Hi, 1. Does this seem to you to be the right Newsgroup to ask this question ? I would have suggested "microsoft.public.dotnet.framework.adonet". 2. Is there supposed to be a difference between the Message Subject and the Message body ? Isn't the Message Subject supposed to be abbreviated ? 3. As for your question : I strongly doubt if your VS.NET can be called "o...

create an upper and lower control limit in Excel 2003?
How do I create an upper and lower control limit in Excel 2003? Jon has lots of examples at http://peltiertech.com/Excel/Charts/AddLineHorzErrBar.html best wishes -- Bernard Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme "Gayle" <Gayle@discussions.microsoft.com> wrote in message news:6A666F42-8955-4099-90CC-422FFB05C973@microsoft.com... > How do I create an upper and lower control limit in Excel 2003? ...

Dumb MFC Question
I have a really dumb question. In my code when I create a CPen, CFont, CBrush, ... and select them into a device context (CDC or CClientDC or other MFC wrapped DC). These objects are not cleaned up. Johan Rosengren has been helping me with some issues (Thanks Johan for you time away from your family this weekend) and he said that I needed to delete the CFont and other objects. That got me curious and I looked at the destructors of these objects (that can be selected into the DC) and sure enough, they don't call DeleteObject method to release them from the system. These include: CPen C...

How to create a CRMActivityAttachment with a file attached
Hi, i want to know if its possible create a CRMActivityAttachment with a file attached. I had note that the data that is inserted in the CRM Data Base goes to an table that have the name ActivityMimeAttachment. In that table there are three columns that have the following names, FileSize, Mymetype and FileName, i had try to put that values in that table, however when i try to save the attach in the CRM, nothing happens, i've suppose that's because i don't have explicite the location of the file. Other doubt is when i create an note in crm with an attachment, where goes the ...

Creating Multiple Pie Charts from Excel Sheet
Creating Multiple Pie Charts from Excel Sheet I have an Excel sheet with the following: -1 header row with the column names. -5 individual rows of unique numerical data underneath. How can I create 5 separate pie charts each using a separate row and the header row without going through the chart wizard for each separate row? Needless to say, I have about 75 rows in the actual example. Any suggestions? Once you have set up one pie chart, you can select this chart by clicking on it (you should see small black squares in the corners and midpoints of the chart area) then you can click <cop...

Create summary tab of last entry/row on all tabs in workbook
I am tracking projects in a workbook. I have a tab/worksheet for each project. For a weekly status meeting I create a spreadsheet that has the last entry/row from each tab. Is there a way to program so I do not have to copy/paste from each tab each week? I do add and delete tabs/projects from time to time. PS- not very adept at the technical details so need to respond to me in simple terms : ) You might want to submit your question to an Excel NG since I don't see anything in your question regarding MS Access. IMHO, I would move the workbooks to an Access database rather than...

Simple drawing application fails
Hi, I have a simple application where I draw som lines and circles in two funtions called by the OnPaint(). However it fails. One function draws an 'X' and the other 'O' in the ClientDc. The problem is that I only get som '/' instead of an 'X' when drawing an 'X'? Does this has something to do with which device context I use? In the turorial I have the onPaint handler uses the CPaintDc dc and passes the dc as a pointer to the functions meanwhile in my code I use the CClientDC locally in the function? This is my pseudo code: OnPaint() { dra...

Application not receiving messages
I've an MDI application with 2 different doc templates and 2 corresponding menus plus the "empty application" menu. In all of them, I've defined a menu option associated to the resource ID_FILE_MRU_FILE1, in order to be able to implement MRU lists in my software. I also have declared the message map for that function: ON_COMMAND_RANGE(ID_FILE_MRU_FILE1,ID_FILE_MRU_FILE16 , OnMRUFile) and the function void CMainFrame::OnMRUFile(UINT nID) { ... } Now, if I hit that option while the menu being displayed is the "empty application" menu, I get the desired behavio...

create a master worksheet template
Is there a way to create a "master" worksheet in excel that will flow all changes in it to it's copies? Thanks Derek ...

How to create menu dynamically....?
hi! I m creating menu dynamically... n deleting the menu already provided by the default SDI form.. But that is giving me asseration fail error. I m sending code of the program to create menu dynamically.... ///All this i m writing in ....... FrameWnd derived class...OnCreate() method/. CMenu m_mnuTopLevel,m_mnuChildMenu; //Creating Menu m_mnuChildMenu.CreateMenu(); m_mnuTopLevel.CreateMenu (); //Menu style of the Top-level menu BOOL bRet = m_mnuTopLevel.AppendMenu(MF_STRING,900,"&Draw"); bRet = m_mnuTopLevel.AppendMenu(MF_STRING,800,"&About"); //Men...

Can I create an RSS feed with Publisher 2003 input?
I have a church newsletter in MS Publisher we want to publish on the Internet. Is there a way to directly output RSS content from Publisher. A google search doesn't turn up any answers. Thanks! On Mon, 30 Jan 2006 16:36:15 +0000, Richard wrote (in article <101C96ED-DCCF-4066-90AE-9E241D2C2971@microsoft.com>): > I have a church newsletter in MS Publisher we want to publish on the > Internet. Is there a way to directly output RSS content from Publisher. A > google search doesn't turn up any answers. > Thanks! That's because the answer is "no". ...

Automation from an MFC Regular DLL
Hello MVPs, I want to automate MS Excel from an MFC app, and I have followed the AutoProject instruction listed in the MSDN documention. http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/KB/Articles/Q192/3/48.asp&NoWebContent=1 However instead of using VC++6.0 i am using Visual Studio .NET to create the MFC App AutoProject. This works a little different from VC++6.0. When I try to add the Class using a Type Library, in .NET I can use the Add Class From TypeLib Wizard which is a Dialog that allows me to select all the Available type libraries liste...

Can I created a New Doc Type in GP 9.0
How can I create a New Doc Type in GP 9.0? or If it is possible for this to be done. I want to be able to create a new doc type for AP, POP and AR. Thank you, On Aug 25, 8:40=A0pm, KBNYNY <u...@msgroups.net/> wrote: > How can I create a New Doc Type in GP 9.0? or If it is possible for this = to be done. =A0I want to be able to create a new doc type for AP, POP and A= R. > > Thank you, No, there are no settings in GP to add/update document types. You might able to do with dexterity customization. ...

MFC/non-MFC application
How to let the compiler know this is a MFC application? like the code as follow to let the compiler know this is a WIN32 app.: #ifdef _WIN32 .... #endif There is an option in the Project Settings. Look under the "General" tab, and there are options to use MFC in a shared DLL, use MFC statically linked, and not using MFC. joe On Mon, 7 Jul 2003 19:50:45 +0800, <pixelmana> wrote: >How to let the compiler know this is a MFC application? > >like the code as follow to let the compiler know this is a WIN32 app.: >#ifdef _WIN32 >... >#endif > Joseph M....

Launching Outlook Address Book (GAL) from an external application
I'm using an application, HEAT Call Logging, that allows me to add new buttons and have those buttons launch external applications with associated parameters. For example, I've added a new button in HEAT Call Logging which when clicked opens a new mail message. I accomplish this with the following command-line argument: C:\Program Files\Microsoft Office\Office11\Outlook.exe /c ipm.note I'd like to create a similar action which duplicates the exact functionality of clicking the Address Book button from within Outlook. By default, that button brings up our Global Address List. Is...

Debug application using Visual Studio Tools
hi, I have create an application that run through GP. i followed the examples but i am not able to debug my application being run through GP. i have added the app in the Addins folder. the code runs and my app works but i could not debug while i was running it. i attached the dynamics process in VS 2005 but on my break points say "No symbols are loaded for this document". i had to resort to message boxes and actually changing the solution to be a windows application and then running it through VS 2005 for the Forms not directly linked to GP. is there anything i am missing or a...

Windows application types: SDI, MDI and Dialog-based
Hello. This question is related to the proper choice of a Windows application type. Visual C++ 6.0's AppWizard offers 3 choices: SDI, MDI and Dialog-based. It's not difficult to understand the differences between SDI and MDI. It also seems reasonable that there's an option for less complex applications, which merely require some user input in order to configure and run a process (Dialog-based). However, it seems to me that this set of choices leaves a gap whereby certain kinds of applications don't find an exact match. For instance, one can think of a number of applica...

create invoices
I am trying to create a billing system for my business. I need to create invoices so that I do not have to keep putting the information in custom. name, add. etc. Also have the invoice numbers automatically go to the next number. I cannot fing any information as to how to do all of this. If someone could point me in the right direction I would be greatly appreciative. For invoice numbers, take a look here: http://www.mcgimpsey.com/excel/udfs/sequentialnums.html In article <5782907F-6E98-4E60-A451-177FE699DDA6@microsoft.com>, Missie <Missie@discussions.microsoft.com> ...

get handle (or CMenu*) to the Main Menu?
I've just been asked to take the reigns of an older MFC/Dialog App. I'm not an MFC expert so this may be simple to some people. I need to disable certain menu items in various sub menus of the main menu. For example, I'd like to disable the "Print" menu item in the File sub menu. I checked MSDN and found some various example and info, but I can't get my code to work. Here is the code I'm trying: <code> CMenu* pMenu = GetMenu(); ASSERT(pMenu && ::IsMenu(pMenu->m_hMenu)); CMenu* pSubMenu = pMenu->GetSubMenu(0); ASSERT(pSubM...

Tab keys and accelerators don't work in mfc regular dll #2
I am wondering why I can't get tab keys or accelerators to work in a mfc regular dll my main application is calling. It doesn't matter if mfc is statically linked or shared. Raj See if the following posts from the archives helps you. http://tinyurl.com/l52g http://tinyurl.com/l52i -- Cheers Check Abdoul [ VC++ MVP ] ----------------------------------- "Raj Kulkarni" <rajkulkarni@gl.com> wrote in message news:#ZengswaDHA.384@TK2MSFTNGP12.phx.gbl... > I am wondering why I can't get tab keys or accelerators to work in a mfc > regul...

Create Addin for Excel 2007 template
I have an Excel template that I already customized all the Ribbon's controls such as disabling SaveAs, Print, etc. I'm looking for a way that I can create and integrate an Addin into Excel such that whenever I open up a excel workbook, it will load up the workbook into my template. Can you please point me where I can get further instructions on that? Thanks and appreciate for your help. ...