Solved

Display menu with form

Posted on 2004-04-15
4
501 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to gracefully close the c++ 11 thread? 3 83
passing data from one form to another form in c++ 27 75
C++ mouse_event mouse look 7 70
FMX TCameraComponent Problem 2 52
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…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

920 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

13 Experts available now in Live!

Get 1:1 Help Now