-
July 17th, 2013, 01:48 PM
#1
CFormView as Main View
Is it possible to use a CFormView as the main view without using document support. IE pointing CWinApps m_pMainWnd to the CFrameWnd derived MainFrame and attaching the CFormView from there. It does not seem to be working and I was wondering before I waste any more time on the solution if it is even possible. I know it is an easy solution if I create a true SDI application however I have no use for documents in this application.
-
July 17th, 2013, 01:52 PM
#2
Re: CFormView as Main View
It's possible, but I'm not sure what the point would be. You could always create a doc/view app but just not use the doc part of it. It won't to have a CDocument class in your project, and leaving it in is easier than trying to force it to work without it.
-
July 17th, 2013, 02:01 PM
#3
Re: CFormView as Main View
That's what I was suspecting. Was just hoping I could do it without document support because without registering the doc and calling on new wont the app fail on creation?
-
July 17th, 2013, 02:43 PM
#4
Re: CFormView as Main View
You could stop through the OnFileNew code and pull out the document stuff, but again, I don't see the point.
-
July 19th, 2013, 11:46 AM
#5
Re: CFormView as Main View
True. I just kept the document in added cs.style &= ~FWS_ADDTOTITLE; to precreatewindow and just ignored all other document calls except for the initial creation. I felt it was just easier just to create a blank WIN32 project and add my classes manually instead of using the predefined MFC wizard. Thanks for your feedback though.
-
July 19th, 2013, 04:09 PM
#6
Re: CFormView as Main View
Originally Posted by RobNHood
I felt it was just easier just to create a blank WIN32 project and add my classes manually instead of using the predefined MFC wizard.
It's rarely ever better to start from scratch when using MFC. Even if you could do it, you usually end up with code that is difficult to maintain (by experienced MFC folks) and often breaks the standard MFC IDE features like the class wizard.
-
July 19th, 2013, 04:26 PM
#7
Re: CFormView as Main View
I am a retired programmer (turning 50 next month) with VI for over 20 years. It has been a while however since I have had the need to work with Windows GUI since almost all of the programming I have done did not require GUI. So I am a bit rusty in that area but it is all coming back to me. I found it better to always work without the wizards. For MFC I just add #include <afxwin.h> and then set the program configuration to link with MFC and include the optional libs I require and add a rc file then any class is ready to be added via normal means. This always means less overhead, smaller compiled size and only the required includes you actually need. I am not a novice when it comes to programming I have been doing it since the days of DOS I do appreciate your input though and for most I am sure the wizards are fine. I just prefer more control.
-
July 19th, 2013, 04:44 PM
#8
Re: CFormView as Main View
Originally Posted by RobNHood
I am a retired programmer (turning 50 next month) with VI for over 20 years. It has been a while however since I have had the need to work with Windows GUI since almost all of the programming I have done did not require GUI. So I am a bit rusty in that area but it is all coming back to me. I found it better to always work without the wizards. For MFC I just add #include <afxwin.h> and then set the program configuration to link with MFC and include the optional libs I require and add a rc file then any class is ready to be added via normal means. This always means less overhead, smaller compiled size and only the required includes you actually need. I am not a novice when it comes to programming I have been doing it since the days of DOS I do appreciate your input though and for most I am sure the wizards are fine. I just prefer more control.
My experience is from the pain of taking over built from scratch MFC projects where nothing basically works. In this case, trying to add a new dialog or a view becomes a royal hassle because all the MFC plumbing is broken. Unfortunately, folks that start from scratch generally don't know what they've broken, because they don't use the wizards or the other features.
That being said, to each his own and that's the cool thing about programming: there are many ways of skinning the cat.
-
July 19th, 2013, 04:56 PM
#9
Re: CFormView as Main View
If you start with 0 files add add a stdafx.h with 1 line #include <afxwin.h>add a stdafx.cpp with #include "stdafx.h" then link to MFC as shared lib then the MFC Class wizard will work as usual with nothing broken that is all MFC actually requires to function. I have since added 6 dialogs, Propertysheets and pages for configuration, dockable panes, toolbars etc. all functional with no build errors. Just try the bare minimum as I pointed out and afterwards use the class wizard to add a CWinAppEx, CFrameWndEx, CView and CDocument and you will see it is much easier and more efficient than using MFCs wizard and templates.
-
July 19th, 2013, 06:12 PM
#10
Re: CFormView as Main View
I'm with Arjay on this one, which is why I suggested use the normal framework but ignore the document. It's going to work, and other programmers will understand it and know how to work with it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|