Another MFC question

Hi,

MFC question. I'm parsing the command line within InitInstance() and storing this within member variables of the App class (the sub class of ZWinApp).

How can I access these variables from my CMainFrame class (the sub class of CFramWnd)?

Any help would be much appreciated. Thanks.
I still am NOT the guy to ask about MFC, but http://msdn.microsoft.com/en-us/library/5k9f064x(VS.80).aspx suggests that you can get your main CWinApp object using the AfxGetApp() function. It would be a matter of dynamically casting it to type ZWinApp:

1
2
3
4
5
6
7
ZWinApp *app = dynamic_cast<ZWinApp*>(::AfxGetApp());
//If the cast fails, the pointer is NULL.
if (app)
{
    //Good.  Call whatever member you need:
    app-><The member name>;
}
Topic archived. No new replies allowed.