Click here to Skip to main content
15,904,153 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: This is Reg RichEditView Pin
Anand Paranjpe5-Oct-03 23:35
Anand Paranjpe5-Oct-03 23:35 
GeneralDisabling the System Menu Pin
Dov Sherman5-Oct-03 22:44
Dov Sherman5-Oct-03 22:44 
GeneralRe: Disabling the System Menu Pin
Stlan5-Oct-03 22:56
Stlan5-Oct-03 22:56 
QuestionHow to create a project template? Pin
junli5-Oct-03 22:32
junli5-Oct-03 22:32 
GeneralScrollbar sizes Pin
Stlan5-Oct-03 22:00
Stlan5-Oct-03 22:00 
GeneralGetSystemMetrics Pin
Stlan5-Oct-03 22:48
Stlan5-Oct-03 22:48 
GeneralCommunication betwwen classes Pin
BlackRider5-Oct-03 21:36
BlackRider5-Oct-03 21:36 
GeneralRe: Communication betwwen classes Pin
jhwurmbach5-Oct-03 22:01
jhwurmbach5-Oct-03 22:01 
As you said, in your view-class, you have a CDocument-pointer.
You can then call functions on the pointer, just as if it were a local variable:
CDocument* pDoc [needs to hold the pointer to the current Document]
pDoc->ADocumentFunction();

But this way you can only access functions of the MFC-CDocument-class, not any extension you made in a derived class CMyDocument.
For this, you need to cast. But for that, you need to be sure that you are working with an instance of CMyDocument. But that is easy, unless in very special circumstances where your application can open different type of documents and you have made different classes derived from CDocument.
Here is how to cast:
CMyDocument* pMyDoc = static_cast<CMyDocument*>(pDoc);
This line tells the compiler to treat your CDocument-pointer as the CMyDocument-pointer that it really is and assign it to the variable pMyDoc. Subsequently, CMyDoc points to the same object as pDoc, but treats it as a CMyDocument instead as a CDocument (as pDoc does).




Who is 'General Failure'? And why is he reading my harddisk?!?
GeneralRe: Communication betwwen classes Pin
BlackRider5-Oct-03 23:12
BlackRider5-Oct-03 23:12 
GeneralRe: Communication betwwen classes Pin
jhwurmbach5-Oct-03 23:17
jhwurmbach5-Oct-03 23:17 
GeneralRe: Communication betwwen classes Pin
spiritualfields6-Oct-03 4:45
spiritualfields6-Oct-03 4:45 
QuestionShowing page of pdf file? Pin
Brian van der Beek5-Oct-03 20:47
Brian van der Beek5-Oct-03 20:47 
AnswerRe: Showing page of pdf file? Pin
J. Dunlap5-Oct-03 20:49
J. Dunlap5-Oct-03 20:49 
GeneralRe: Showing page of pdf file? Pin
Brian van der Beek5-Oct-03 21:17
Brian van der Beek5-Oct-03 21:17 
GeneralRe: Showing page of pdf file? Pin
J. Dunlap5-Oct-03 21:24
J. Dunlap5-Oct-03 21:24 
AnswerRe: Showing page of pdf file? Pin
Bernhard6-Oct-03 4:29
Bernhard6-Oct-03 4:29 
GeneralRe: Showing page of pdf file? Pin
Brian van der Beek6-Oct-03 4:37
Brian van der Beek6-Oct-03 4:37 
GeneralRe: Showing page of pdf file? Pin
Bernhard6-Oct-03 4:42
Bernhard6-Oct-03 4:42 
GeneralAccessing a file's properties from a VC++ application Pin
jopett5-Oct-03 20:43
jopett5-Oct-03 20:43 
GeneralRe: Accessing a file's properties from a VC++ application Pin
David Crow6-Oct-03 3:13
David Crow6-Oct-03 3:13 
GeneralAbstract Factory in C++ Pin
Saurabh_Delhi5-Oct-03 19:46
Saurabh_Delhi5-Oct-03 19:46 
GeneralProgrammers needed Pin
LOSTTWARE.com5-Oct-03 18:29
LOSTTWARE.com5-Oct-03 18:29 
GeneralRe: Programmers needed Pin
KaЯl6-Oct-03 3:13
KaЯl6-Oct-03 3:13 
GeneralC++ Question. Pin
WREY5-Oct-03 17:44
WREY5-Oct-03 17:44 
GeneralRe: C++ Question. Pin
Anonymous5-Oct-03 20:47
Anonymous5-Oct-03 20:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.