I have an SDI document that has several dialogs. I declare a member variable from my app.h. I access this member from any dialog of the application using AfxGetApp.

What I want to do, I want to declare a member variable on my doc.h where I want to access that member from other dialog. Since AfxGetApp return a pointer to the application class and I am working in the document class, I wonder if I can use GetDocTemplate to access the member of the document class from any other dialog as I did from the application class.