Get pointer of CView of a CDocument-Object
Hello,
I want to get a pointer of one CView of my CDocument-Object.
It does not matter what view.
Has every CDocument at least one CView ? (MDI-app !)
Can I presum that
GetNextView(GetFirstViewPosition()) returns a valid CView-Object ?
Ralf
Re: Get pointer of CView of a CDocument-Object
Have a look at MSDN: CDocument::GetNextView
BTW, why do you need "to get a pointer of one CView of ... CDocument-Object"?
Re: Get pointer of CView of a CDocument-Object
Documents don't necessarily have views.
Re: Get pointer of CView of a CDocument-Object
Quote:
Originally Posted by
VictorN
Have a look at MSDN:
CDocument::GetNextView
BTW, why do you need "to get a pointer of one CView of ... CDocument-Object"?
Hello Victor,
it is a little bit complicated to explain.
I need it do call OnDraw directly.
I think, it is not usual to do it, but it is necessary.
Ralf
Re: Get pointer of CView of a CDocument-Object
Quote:
Originally Posted by
GCDEF
Documents don't necessarily have views.
in what case there is no CView for an every CDodument in a MDI-app ?
Re: Get pointer of CView of a CDocument-Object
Quote:
Originally Posted by
Ralf Schneider
Hello Victor,
it is a little bit complicated to explain.
I need it do call OnDraw directly.
I think, it is not usual to do it, but it is necessary.
Ralf
You should (must!) not do it!
Instead you should call Invalidate (or InvalidateRect) for the view you want to draw/redraw something
Re: Get pointer of CView of a CDocument-Object
Quote:
Originally Posted by
VictorN
You should (must!) not do it!
Instead you should call Invalidate (or InvalidateRect) for the view you want to draw/redraw something
I do not want to render it on the screen.
I want to create a Metafile !
I call OnDraw with the DeviceContext of the metafile.
Re: Get pointer of CView of a CDocument-Object
Quote:
Originally Posted by
Ralf Schneider
in what case there is no CView for an every CDodument in a MDI-app ?
Code:
CMyDocument myDocument;
There should be a view if it's created by the framework. I'm with Victor though. I don't see why you'd need the view from the document. That sounds like a design problem.