Click here to Skip to main content
15,887,936 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: a problem by linked list ; help needed Pin
Stephen Hewitt3-Mar-06 20:19
Stephen Hewitt3-Mar-06 20:19 
QuestionProblem with registering ITTAPIEventNotification interface Pin
bisvl3-Mar-06 5:57
bisvl3-Mar-06 5:57 
QuestionHow do make a FormView without Doc/View Pin
Jethro633-Mar-06 5:49
Jethro633-Mar-06 5:49 
QuestionRe: How do make a FormView without Doc/View Pin
David Crow3-Mar-06 6:07
David Crow3-Mar-06 6:07 
AnswerRe: How do make a FormView without Doc/View Pin
Jethro633-Mar-06 7:15
Jethro633-Mar-06 7:15 
QuestionRe: How do make a FormView without Doc/View Pin
David Crow3-Mar-06 7:20
David Crow3-Mar-06 7:20 
AnswerRe: How do make a FormView without Doc/View Pin
Jethro633-Mar-06 8:36
Jethro633-Mar-06 8:36 
AnswerRe: How do make a FormView without Doc/View Pin
Office Lineman3-Mar-06 14:07
Office Lineman3-Mar-06 14:07 
This is a method for creating an MFC CFormView application with no document--and the form window is not to be resized. If you don't mind the window being resized, don't do the frame/maximize box step. Sorry about the formatting, but it's from a Word doc, and I'm too lazy to clean up Word 2K's crummy HTML output Laugh | :laugh: :

1. Create a new MFC AppWizard (exe) project.
	a. MFC AppWizard - Step 1 of 6
		i. Select "Single document" for the application type.
		ii. Uncheck "Document/View architecture support?".
	b. MFC AppWizard - Step 2 of 6 - no changes
	c. MFC AppWizard - Step 3 of 6 - no changes
	d. MFC AppWizard - Step 4 of 6
		i. Set the number of files on the recent file list to 0. (optional - no MRU anyway)
		ii. Press "Advanced..."
			1. Uncheck "Thick frame" and "Maximize box", leaving only "Minimize box" and "System menu" checked. (optional)
	e. MFC AppWizard - Step 5 of 6 - no changes
	f. MFC AppWizard - Step 6 of 6 - no changes
2. Create a CFormView for the application.
	a. Select Insert->New Form....
	b. Enter a form class name in the "Name" field, e.g. "CMyFormView".
	c. Press OK.
	d. Design the form as desired.
3. Adjust command handlers in new CFormView-based class.
	a. Using the ClassWizard, insert a handler for OnInitialUpdate.
	b. Add the following code into the OnInitialUpdate handler where indicated:
		GetParentFrame()->RecalcLayout();
		ResizeParentToFit();
4. Remove ChildView.h and ChildView.cpp from the project.  Delete the files.
5. Remove CChildView references from MainFrm.h
	a. Remove the "#include ChildView.h" directive.
	b. Remove the "CChildView m_wndView" member.
6. Adjust command handlers in MainFrm.cpp
	a. Remove the OnCmdMsg handler and delete its code.
	b. Remove the OnSetFocus handler and delete its code.
	c. Edit the OnCreate handler
		i. Remove the view creation code:
			// create a view to occupy the client area of the frame
			if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
			{
				TRACE0("Failed to create view window\n");
				return -1;
			}
		ii. Remove the docking capability for the toolbar by commenting out or deleting the indicated lines. (optional)
7. Adjust application creation in <appname>.cpp
	a. Include the view class header, e.g. "#include "MyFormView.h".
	b. Edit the InitInstance function
		i. Replace the frame loading code:
				pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL);
			with the following code:
				CCreateContext oCreateContext;
				oCreateContext.m_pNewViewClass = RUNTIME_CLASS(CMyFormView);
				oCreateContext.m_pCurrentFrame = pFrame;
				pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW, NULL, &oCreateContext);
				pFrame->InitialUpdateFrame(NULL, TRUE);

Everything should compile okay.  N.B. when you run the application in debug mode, you will receive "Warning: Creating a pane with no CDocument." in the debug output.  It's a nice warning, but that WAS kind of the whole point, right?


--
I've killed again, haven't I?
GeneralRe: How do make a FormView without Doc/View Pin
Jethro6328-Dec-06 5:05
Jethro6328-Dec-06 5:05 
GeneralRe: How do make a FormView without Doc/View Pin
permutations19-Apr-10 13:07
permutations19-Apr-10 13:07 
GeneralRe: How do make a FormView without Doc/View Pin
Rez_Spain6-May-10 23:07
Rez_Spain6-May-10 23:07 
QuestionWhat is IsolatedStorage Pin
Chintoo7233-Mar-06 5:47
Chintoo7233-Mar-06 5:47 
AnswerRe: What is IsolatedStorage Pin
Chintoo7233-Mar-06 5:58
Chintoo7233-Mar-06 5:58 
Questioncopying an array of bytes to another array Pin
chaitanya223-Mar-06 5:24
chaitanya223-Mar-06 5:24 
AnswerRe: copying an array of bytes to another array Pin
RChin3-Mar-06 5:30
RChin3-Mar-06 5:30 
GeneralRe: copying an array of bytes to another array Pin
David Crow3-Mar-06 5:49
David Crow3-Mar-06 5:49 
GeneralRe: copying an array of bytes to another array Pin
chaitanya223-Mar-06 5:55
chaitanya223-Mar-06 5:55 
GeneralRe: copying an array of bytes to another array Pin
David Crow3-Mar-06 6:28
David Crow3-Mar-06 6:28 
GeneralRe: copying an array of bytes to another array Pin
chaitanya223-Mar-06 5:51
chaitanya223-Mar-06 5:51 
QuestionRe: copying an array of bytes to another array Pin
David Crow3-Mar-06 6:05
David Crow3-Mar-06 6:05 
AnswerRe: copying an array of bytes to another array Pin
chaitanya223-Mar-06 6:09
chaitanya223-Mar-06 6:09 
QuestionPARAFORMAT2 Structure Pin
Richard_483-Mar-06 5:10
Richard_483-Mar-06 5:10 
AnswerRe: PARAFORMAT2 Structure Pin
Jeremy Falcon3-Mar-06 7:26
professionalJeremy Falcon3-Mar-06 7:26 
QuestionStack overflows Pin
Waldermort3-Mar-06 4:14
Waldermort3-Mar-06 4:14 
AnswerRe: Stack overflows Pin
David Crow3-Mar-06 4:33
David Crow3-Mar-06 4:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.