J'ai trouvé du code qui répondrai je pense très bien à ma question à l'adresse suivante :
http://www.codeguru.com/cpp/controls...cle.php/c5939/
Dans le projet de cette personne, on trouve le bout de code suivant :
1 2 3 4 5 6 7 8 9 10 11 12
|
void CMainFrame::OnUpdateCurPosIndicator(CCmdUI *pCmdUI)
{
CString strCurPos;
int nLineNum, nColNum;
int nSelStart, nSelEnd;
// you're going to have to get a pointer
// to the edit control in the view
m_wndEditCtrl[/COLOR]->GetSel(nSelStart, nSelEnd);
...
} |
et la fonction suivante qui permet l'initialisation de "m_wndEditCtrl" :
1 2 3 4
| void CMainFrame::SetEdit(CEdit *pEditCtrl)
{
m_wndEditCtrl = pEditCtrl;
} |
J'appel la fonction dans une classe qui dérive de la classe MFC CEditView par le code suivant :
((CMainFrame*)AfxGetApp()->m_pMainWnd)->SetEdit(&GetEditCtrl());
mais j'ai un problème à la compilation car :
1 2
| error C2065: 'CMainFrame' : undeclared identifier
error C2059: syntax error : ')' |
Je ne comprend pas pourquoi il ne reconnait pas CMainFrame
Pouvez vous m'aidez?
Partager