Free Web Site - Free Web Space and Site Hosting - Web Hosting - Internet Store and Ecommerce Solution Provider - High Speed Internet
Search the Web

How to access objects

VC++ (MFC) Tips :     Application Object


   1. Any object can obtain a pointer to the application object by calling the global function AfxGetApp. For example:

HCURSOR    m_hCursor;
m_hCursor=AfxGetApp()->LoadStandardCursor(IDC_CROSS);
SetCursor(m_hCursor);

   2. Gaining Access to Other Objects in Your Application

From:                     How:

Document           Use GetFirstViewPosition and GetNextView to access the document's view list.
                              Call GetDocTemplate to get the document template.

View                      Call GetDocument to get the document.
                              Call GetParentFrame to get the frame window.

Document frame window                      Call GetActiveView to get the current view.
                                                                   Call GetActiveDocument to get the document attached to the current view.

MDI frame window                                   Call MDIGetActive to get the currently active CMDIChildWnd.


Copyright (c) 1999 - 2001, robert han, all rigths are reserved.