How do I get a pointer to my main frame class. Specifically, I have a variable in my CMainFrm class that I want to set in my CView class. I need a pointer to my CMainFrame so I can type:
pMainFrm->variable = 0;
Right?
Thanks..
Printable View
How do I get a pointer to my main frame class. Specifically, I have a variable in my CMainFrm class that I want to set in my CView class. I need a pointer to my CMainFrame so I can type:
pMainFrm->variable = 0;
Right?
Thanks..
Use the function AfxGetMainWnd(). You must cast the return value to your actual mainwindow class. For example:
((CMainFrame*)AfxGetMainWnd())->variable = 0;
try like this :
CMyFrame * frame;
frame = (CMyFrame*)GetParent();
frame->variable = 0;