appleby
asked on
Getting ahold of a Window
I need to call a member function of a view class. I am
calling it from a function that is totally unrelated and in
a separate file of (non-classed) functions. How do I get
ahold of the view's instance so I can call the function?
It isn't static.
There is always one instance of this view open.
calling it from a function that is totally unrelated and in
a separate file of (non-classed) functions. How do I get
ahold of the view's instance so I can call the function?
It isn't static.
There is always one instance of this view open.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Answers2000, what is going on with that first line you suggest adding to the view's .cpp?
CSomeView * CSomeView::pTheView=NULL;
I've never seen this type of syntax before. Why is it necessary, instead of just going right to the constructor?
CSomeView * CSomeView::pTheView=NULL;
I've never seen this type of syntax before. Why is it necessary, instead of just going right to the constructor?
ASKER
I get it - just an initializer. Ok thanks!
m_pView = ((CFrameWnd *)AfxGetMainWnd())->GetAct
Also, you can use the following calls to get other imp ptrs.
m_pMainWnd = (CFrameWnd*)AfxGetMainWnd(
m_pApp = AfxGetApp();