Solved

CView without a document

Posted on 1998-11-19
6
319 Views
Last Modified: 2013-11-20
When creating a SDI application without document/view support, the frame's view is derived from CWnd. Is it ok to derive this view from CView and not attach a document? Will I need to set the document pointer to NULL?
0
Comment
Question by:tds195
6 Comments
 
LVL 1

Expert Comment

by:fstab
ID: 1324974
Yes it is perfectly allowable for you to derive it from CView and not attach a document. What do you mean by "Will I need to set the document pointer to NULL" - where do you want to set it to NULL ?
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1324975
What in the CView(without a document) would you need that is not in a CWnd?
0
 

Author Comment

by:tds195
ID: 1324976
I was thinking about the fact that you normally use a CSingleDocTemplate to associate the document with the view and was wondering how where this association is made.2
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:tds195
ID: 1324977
I need to support printing and drag and drop.
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 1324978
what's the problem with having a document ?

0
 
LVL 3

Accepted Solution

by:
plaroche earned 50 total points
ID: 1324979
Also, what is a SDI without document/view support?  The D in SDI means Document.....

Yes you can replace it by a CView if your CView has a NULL document.  If you check MFC code most view class members check for a NULL document (see viewcore.cpp) and handle it correctly.  

Your printing mecanism will also work, the doctitle will come from the frame window's title (see viewprnt.cpp).

If your existing CWnd object that you wish to replace is already plugged in the command-message routing then you won't have any problems. If it is not plugged in your view won't get the ID_FILE_PRINT command to print its stuff.  Your frame might trap the message and relay it to the view or override OnCmdMsg in your frame and call the view's OnCmdMsg first. This will effectively plug the view in the command message routing.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
centeredAverage challenge 8 124
has77  challenge 9 68
pre4 challenge 19 88
Problem to event 3 50
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

17 Experts available now in Live!

Get 1:1 Help Now