(Urgent, plz help)Problem getting app pointer in VC1.52 (16bit) 
Author Message
 (Urgent, plz help)Problem getting app pointer in VC1.52 (16bit)

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



Fri, 15 Aug 2003 01:59:10 GMT  
 (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]



Fri, 15 Aug 2003 03:13:50 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with vc1.52, dos window in win95 and graphics program

2. VC1.52 Compiler optimisation problem

3. HELP! Whats wrong with this code?VC1.52

4. Help - How to access MS-ACCess from VC1.52

5. Help porting VC1.52 DLL to VC2.2 DLL

6. Help: CRecordset using Oracle7 and VC1.52

7. ldllcew.lib - converting VC1.52 to VC5

8. VC1.52 and Win95

9. VC1.52 Setup Install Program

10. Tabbing using VC1.52

11. VC1.52!!Whats wrong with this??

12. OCX Control in a VC1.52??

 

 
Powered by phpBB® Forum Software