I am creating an MFC SDI explorer style application (it has a splitter bar and the right-hand pane is the text-edit area, left-hand pane is the tree-view)
My right-hand pane is a CRichEditView.
I want to be able to detect when a user has edited the text so that a flag is set to show that a change has been made but has not been saved. I have tried several ways of doing this e.g. catching WM_KEYDOWN in PreTranslateMessage, but this seems to catch everything and prevents the keypresses from editing the view. I have also tried adding ON_WM_KEYDOWN() to the message map in the MyView.cpp. Again, this seems to prevent the keystrokes from having any affect on the text in the view. I want to allow the user to edit the text in the view, but the application to know that this has been done.
I then tried setting the flag and then calling the function that I am overriding, as below, but it doesn't compile and the error is:
error C2248: 'CWnd::OnKeyDown' : cannot access protected member declared in class 'CWnd'
void CBWE8View::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
int i = 1;
CWnd* pWndMain = AfxGetMainWnd();
pWndMain->OnKeyDown(nChar, nRepCnt, nFlags);
}
Any suggestions please?