class MyApp : public CWinApp { int value; public: int GetValue() const { return value; } }; inline MyApp* getMyApp() { return (MuyApp*)AfxGetApp(); } class MyFrame : public CFrameWnd { void GetValue() { int val = getMyApp()->GetValue(); } };