SDI Application, sending a message
Posted on 2003-03-14
I have an SDI application (I usually do dialog based) and I need to send messages between different classes.
This SDI application in particular is an explorer style class - with the explorer bar on the left. Now I *think* that I need messages to accomplish what I need.
If the user clicks in the left explorer pane then I need to display a different dialog on the right pane. Now apparently I can only switch views and such (I really have no idea) from the CMainForm class. However the click occurs in the LeftView class.
So I figured I would send a message from the LeftView class to the MainForm class. Is that thought correct? I just can't seem to comprehend the MFC SDI stuff - MFC in general :(
So anyway, I added the following code to the MainForm class:
// Header File
afx_msg LRESULT OnChangeView(WPARAM wParam, LPARAM lParam);
// In Cpp File
LRESULT CMainFrame::OnChangeView(WPARAM wParam, LPARAM lParam)
but it won't compile and frankly I have no idea if I did it even right. These are the errors I am getting:
error C2440: 'type cast' : cannot convert from 'unsigned int CMainFrame::*' to 'unsigned int *'
There is no context in which this conversion is possible
error C2440: 'initializing' : cannot convert from 'void (__thiscall CCmdTarget::*)(void)' to 'unsigned int'
Conversion is a valid standard conversion, which can be performed implicitly or by use of static_cast, C-style cast or function-style cast
Does anybody have any idea?
Thanks a lot ...