G
Guest
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 "OleInitialize returne
scode RPC_E_CHANGED_MODE"
The documentation says
RPC_E_CHANGED_MODE
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::CreateDlgControls at (Line 410
COleControlSiteOrWnd *pTemp =new COleControlSiteOrWnd:GetDlgItem(pWndParent->GetSafeHwnd(),
pOccDlgInfo->m_pItemInfo.nId),pOccDlgInfo->m_pItemInfo.bAutoRadioButton)
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 "OleInitialize returne
scode RPC_E_CHANGED_MODE"
The documentation says
RPC_E_CHANGED_MODE
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::CreateDlgControls at (Line 410
COleControlSiteOrWnd *pTemp =new COleControlSiteOrWnd:GetDlgItem(pWndParent->GetSafeHwnd(),
pOccDlgInfo->m_pItemInfo.nId),pOccDlgInfo->m_pItemInfo.bAutoRadioButton)
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