OCX problem in VS2005
I have an OCX ( a regular MFC DLL dynamically linked with MFC, built
with _USRDLL and _AFXDLL). The problem I am facing is that when my MFC
application load this OCX, the m_classList member variable of
AFX_MODULE_STATE get resets to NULL. This was not happening with
OCX IinitInstance is defined as
CFooApp is derived from COleControlModule and COleControlModule is
derived from CWinApp.
The function exposed in this OCX is
From the application I am calling, DllRegisterServer exposed in this
So wanted to know what is wrong in this OCX which is causing the
AFX_MODULE_STATE class list to be deletd or why it is not restoring
the MainApp manage state ? Why this problem in VS2005 ?
After this DLL gets loaded, the for loop in follwing code is not
executed and MessageBox "Found" not displayed.
AFX_MODULE_STATE* pModuleState = AfxGetModuleState();
for (pClass = pModuleState->m_classList; pClass != NULL;
pClass = pClass->m_pNextClass)
if (lstrcmpA("COrLongProp", pClass->m_lpszClassName) == 0)
The OCX works fine in VS2003. Problem occured when the OCX was moved
to VS2005 ?