Do not instanciate CWinApp object! There should be only one instance per project (the one declared as
theApp
). If you want to access that object, then you there have two options:
1- add
extern CWinApp theApp;
at the end of
CheckVarPropDll.h so it can be accessed in all your .cpp files (of course, make sure they have
#include "CheckVarPropDll.h"
).
2- use the global function
AfxGetApp
. This function returns
CWinApp
pointer (a pointer to
theApp
). You nee then to cast that pointer into your
CWinApp
derived class.
Personnaly, I prefer solution 1:
void EnterValue::GetValue()
{
theApp.CheckVarProp("1234");
}
Or
void EnterValue::GetValue()
{
((CYourWinApp*)AfxGetApp())->CheckVarProp("1234");
}