Solved

Display menu with form

Posted on 2004-04-15
4
489 Views
Last Modified: 2012-06-27
Hello Experts,
I'm new in VC++.
I created an MFC application (in .Net 2002 unmanaged C++) as SDI and added a resource form (IDD_FORMVIEW).
Now I want that after starting the application the menu with the form is displayed.
Actually only the menu and the toolbar is displayed.
If anyone knows what I need to do,
please supply an appropriate information.

Thank you for any help.

  HStrix
0
Comment
Question by:HStrix
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:SteH
ID: 10831651
Is the view of that app derived from CFormView? In that case it should be done automatically. Otherwise you can create a new project where you select within the appwizard that the view is derived from CFormView. That way it will start automatically with that view. Otherwise you need to add a class to the form (IDD_FORMVIEW) derived from CFormView. And now you need to replace all calls to the old view class with that new one. Decide yourself which way is faster.
0
 

Author Comment

by:HStrix
ID: 10831788
Thank you SteH,
I created the MFC environment,
then I added the resource using IDD_FORMVIEW.
Now clicking the right mouse on the form I created a new class
called CMyForm based on CFormView (ID=IDD_FORMVIEW).
But the result is still unchanged.
I did not change anything to the "old view class", is it CFormView?
I found CFormView only in my new class.

  HStrix
0
 
LVL 13

Accepted Solution

by:
SteH earned 200 total points
ID: 10831857
When you used the appwizard to create a new MFC executable on the first page you can select SDI. On the sixth page you can select the base class to be CFormView where it seems that you selected CView. That gives you 4 classes in your class browser:
CYourApp
CYourView
CMainFrame
CYourDoc

You need to replace all occurences of CYourView whihc was derived from CView with CMyForm. These replaces should be in CYourApp and CYourDlg. Only after these steps CMyForm class will the used as view.
0
 

Author Comment

by:HStrix
ID: 10831964
Thank you SteH,
now I modified inside CYourApp the line
  RUNTIME_CLASS(CYourView));
to
  RUNTIME_CLASS(CMyForm));
and added the header file MyForm.h.
And - it works as expected.

Again, thank you very much.

  HStrix
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now