pointers to doc class from other classes
-
Hi, sorry that this might be a beginner question. I know how to get a pointer form View class to doc class. But how do you get a pointer from app class to doc class? is there a way? If not can you get a pointer to app class from doc class? Thanks for your help Q-Bus
-
Hi, sorry that this might be a beginner question. I know how to get a pointer form View class to doc class. But how do you get a pointer from app class to doc class? is there a way? If not can you get a pointer to app class from doc class? Thanks for your help Q-Bus
from the app, I believe you can call GetActiveView() or something. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
-
Hi, sorry that this might be a beginner question. I know how to get a pointer form View class to doc class. But how do you get a pointer from app class to doc class? is there a way? If not can you get a pointer to app class from doc class? Thanks for your help Q-Bus
Do the following: 1.Add a member variable to your app class
CYourDoc* m_pYourDoc;
2.Add a memeber function to your app class:
SetYourDoc(CYourDoc* pYourDoc)
{
m_pYourDoc = pYourDoc;
}3.In your doc class' constructor call
theApp.SetYourDoc(this);
Peter Molnar
-
Hi, sorry that this might be a beginner question. I know how to get a pointer form View class to doc class. But how do you get a pointer from app class to doc class? is there a way? If not can you get a pointer to app class from doc class? Thanks for your help Q-Bus
Qbus wrote: I know how to get a pointer form View class to doc class. If it is a standard MFC Wizard generated view then you can use the GetDocument() function in your view class. Qbus wrote: If not can you get a pointer to app class from doc class? You can use AfxGetApp() and cast the returned value to your class CMyApp* pApp = (CMyApp*) AfxGetApp(); Michael Snow is lying on the ground, and in the air the sleigh bells sound, The frosted patterned window panes, it's British summer time again. No, it's not, It's Christmas - Santa Claus in on the Dole (Spitting Image 1986)