Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cant use GetDocument() from CDockablePane

240 views
Skip to first unread message

Teddy

unread,
Dec 14, 2009, 6:08:01 PM12/14/09
to
Hi, Pls hlp me with this one:

In CPropertiesWnd (comming from CDockablePane, infact the same one from MFC
features pack), i can do CTestDoc* pDoc (Test is my app name)...
...but cant do CTestDoc* pDoc = GetDocument()

What can I do instead?

Scott McPhillips [MVP]

unread,
Dec 14, 2009, 6:17:58 PM12/14/09
to
The CWinApp class maintains a list of CDocuments. So you can get the
document(s) by calling

AfxGetApp()->GetFirstDocTemplatePosition

...and then

CDocTemplate::GetFirstDocPosition and GetNextDoc


"Teddy" <Te...@discussions.microsoft.com> wrote in message
news:AB802C0A-A107-4497...@microsoft.com...

--
Scott McPhillips [VC++ MVP]

Teddy

unread,
Dec 14, 2009, 7:53:01 PM12/14/09
to
Great thanks, Scott! - Works like a charm :)

Exact code used (in case some nabs like me have same difficulties. "Test" is
my prj name):
CTestDoc* pDoc;
CDocTemplate* pDocTemplate;
POSITION pos;
pos = AfxGetApp()->GetFirstDocTemplatePosition();
pDocTemplate = AfxGetApp()->GetNextDocTemplate(pos);
pos = pDocTemplate->GetFirstDocPosition();
pDoc = (CTestDoc*) pDocTemplate->GetNextDoc(pos);

"Scott McPhillips [MVP]" wrote:

> The CWinApp class maintains a list of CDocuments. So you can get the
> document(s) by calling
>
> AfxGetApp()->GetFirstDocTemplatePosition
>

> ....and then


>
> CDocTemplate::GetFirstDocPosition and GetNextDoc
>
>
> "Teddy" <Te...@discussions.microsoft.com> wrote in message
> news:AB802C0A-A107-4497...@microsoft.com...
> > Hi, Pls hlp me with this one:
> >
> > In CPropertiesWnd (comming from CDockablePane, infact the same one from
> > MFC
> > features pack), i can do CTestDoc* pDoc (Test is my app name)...
> > ...but cant do CTestDoc* pDoc = GetDocument()
> >
> > What can I do instead?
>
> --
> Scott McPhillips [VC++ MVP]
>

> .
>

0 new messages