sdi clistview cframewnd

Hi,
i use i sdi document how i can communicate between a clistview and cframewnd !!!!??,,
[93 byte] By [ledaker] at [2007-11-19 18:29:43]
# 1 Re: sdi clistview cframewnd
can you elaborate on what you're trying to accomplish?
Alin at 2007-11-10 23:46:40 >
# 2 Re: sdi clistview cframewnd
add the following function to your frame wnd .h file.
this is not a member function

__inline YourFrameWnd* GET_MAIN_FRAME()
{
YourFrameWnd* mf = static_cast<YourFrameWnd*>(AfxGetMainWnd());
ASSERT(mf && mf->IsKindOf(RUNTIME_CLASS(YourFrameWnd)));
return mf;
}

then from the view class you can access the main frame with this function.

From the frame wnd you can call GetActiveView() to get a pointer to the view.
You could add a member function of YourFrameWnd class;

//forware declarations
class YourViewClass;

class YourFrameWnd
{

private:
YourViewClass* GET_VIEW();

};

//in .cpp
#include "YourViewClass.h"

YourViewClass* YourFrameWnd::GET_VIEW()
{
YourViewClass* view = static_cast<YourViewClass*>(GetActiveView());
ASSERT(view && view->IsKindOf(RUNTIME_CLASS(YourViewClass)));
return view;
}

these functions are just to save the hassle of casting everytime.

I am assuming here that your view class is not going to change
souldog at 2007-11-10 23:47:40 >