-
AfxGetApp in DLL
I am working on the project which is composed of a main EXE with several DLLs. I am trying to get a pointer to the main app (not dll app) by using
AfxGetApp and casitng it but I keep getting a pointer to my DLL app.
How do I get a pointer to the main app.
Thanks
-
Re: AfxGetApp in DLL
Hi,
try this in your dll code:
// switch thread state back to application
_AFX_THREAD_STATE* pState = AfxGetThreadState();
AfxSetModuleState(pState->m_pPrevModuleState);
// do something with the application
AfxGetApp()->...
// switch thread state back to dll
AFX_MANAGE_STATE(AfxGetStaticModuleState())