Hello
I have a VC7 App consisting of "old" MFC-Source and new Manged Source that uses an OC
in one of its MFC-based dialogs
When started, AfxOleInit (called in InitInstance) fails with a message that "OleInitial ize returne
scode RPC_E_CHANGED_M ODE"
The documentation says
RPC_E_CHANGED_M ODE
A previous call to CoInitializeEx specified the concurrency model for this apartment as multithread apartment (MTA).
I guess, that some CLR - related Code has done this (because the same App without /CLR-Optio
and managed Sources does not have this problem
If I comment out the OleInitialize in InitInstance, then the Message disappeares and all seem
to be OK until a MFC-based dialog which contains an OCX is created
At this point an assertion occurs in occmgr.cpp COccManager::Cr eateDlgControls at (Line 410
COleControlSite OrWnd *pTemp =new COleControlSite OrWnd(::GetDlgI tem(pWndParent->GetSafeHwnd( ),
pOccDlgInfo->m_pItemInfo[i].nId),pOccDlgIn fo->m_pItemInfo[i].bAutoRadioButt on)
ASSERT(pTemp->m_hWnd)
How can this problem be solved so that MFC-Source with Dialogs using OCXes can be mixe
with managed C++ source in one App
Thanks in advance for any hint .
Werne
I have a VC7 App consisting of "old" MFC-Source and new Manged Source that uses an OC
in one of its MFC-based dialogs
When started, AfxOleInit (called in InitInstance) fails with a message that "OleInitial ize returne
scode RPC_E_CHANGED_M ODE"
The documentation says
RPC_E_CHANGED_M ODE
A previous call to CoInitializeEx specified the concurrency model for this apartment as multithread apartment (MTA).
I guess, that some CLR - related Code has done this (because the same App without /CLR-Optio
and managed Sources does not have this problem
If I comment out the OleInitialize in InitInstance, then the Message disappeares and all seem
to be OK until a MFC-based dialog which contains an OCX is created
At this point an assertion occurs in occmgr.cpp COccManager::Cr eateDlgControls at (Line 410
COleControlSite OrWnd *pTemp =new COleControlSite OrWnd(::GetDlgI tem(pWndParent->GetSafeHwnd( ),
pOccDlgInfo->m_pItemInfo[i].nId),pOccDlgIn fo->m_pItemInfo[i].bAutoRadioButt on)
ASSERT(pTemp->m_hWnd)
How can this problem be solved so that MFC-Source with Dialogs using OCXes can be mixe
with managed C++ source in one App
Thanks in advance for any hint .
Werne
Comment