Solved

CView without a document

Posted on 1998-11-19
6
322 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
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.

 

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

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
iSeries DB2 Query 2 91
How to know only "File created" with EventLog 3 32
sum67 challenge 35 93
JQuery serialize and unserialize 8 51
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

895 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

11 Experts available now in Live!

Get 1:1 Help Now