Click to See Complete Forum and Search --> : CDocument::GetPathName()


Todd Casey
April 27th, 1999, 03:32 PM
I need to call the CDocument::GetPathName() from my CEditView class. How do I do this? Everytime I try this the compiler gives me an error:

illegal call of non-static member function

I am trying to do it like this:

CString strReturn;

strReturn = CDocument::GetPathName();

What is the function GetPathName? Protected? How do I use this function from another class? Thanks for your help.

Todd
todd@jack-bilt.com

Lissandro
April 27th, 1999, 05:31 PM
Hi, Todd

What seems to be happening here is that you must call it in a different way: you must obtain a pointer to the active document (something like GetDocument(), I don't remember) ant do like this:
CDocument *p = GetDocument() (check the correct call!)
CString strReturn;
strReturn = p->GetPathName();

That should work. :-)