Click to See Complete Forum and Search --> : How do I get a pointer to my Main Frame class?


davedrake1
September 10th, 1999, 09:13 AM
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..

Thomas Ascher
September 10th, 1999, 09:18 AM
Use the function AfxGetMainWnd(). You must cast the return value to your actual mainwindow class. For example:

((CMainFrame*)AfxGetMainWnd())->variable = 0;

ChristianM
September 10th, 1999, 09:18 AM
try like this :

CMyFrame * frame;
frame = (CMyFrame*)GetParent();
frame->variable = 0;