
(Urgent, plz help)Problem getting app pointer in VC1.52 (16bit)
Quote:
> Hi folks,
> I'm using AfxGetApp to get my app pointer but it returns an invalid
> pointer.I write something such as this:
> CMyApp *pApp = (CMyApp *) AfxGetApp();
> i used it in my view class.When i did the same thing in CMyApp class it
> returns the correct pointer.in addition i'm using large memory model.
> Any help would be highly appreciated.Even other ways of getting app pointer
> in my view class.
> TIA.
> --
> M. Shokuie Nia
> MSVC++ Programmer
I've no idea how that could fail. You could try another way, placing
extern CMyApp theApp;
at the bottom of the app h file. Then you can use theApp.Foo() instead of
calling the MFC function for the pointer and then having to cast it. Let
us know how you like it - it's a popular topic this weekend in the ng :)
--
Scott McPhillips [VC++ MVP]