Here is how I proceed:
- The directory containing the qt dlls is in the PATH
- I build the qt example 'activeqt/simple' in VS2008 (launched from the 'Visual Studio with Qt 4.8.2' shortcut)
- I registered the COM server with the cmd 'simpleax.exe /regserver'
- In VS2008 (normal mode, not launched from Visual Studio with Qt 4.8.2 shortcut), I create a new MFC dialog-based application, with the "ActiveX controls" option checked on
- in the main dialog resource view, I right-click and select the "Insert ActiveX control" menu item
- In the "Insert ActiveX control" window list, I select the "QSimpleAX Class" item, and validate the dialog
- There is a white window displayed now in the resource view
- I launch the MFC application in debug mode: a failed assertion occurs in atlmfc\src\mfc\occcont.cpp:
HWND hwndCtrl=AfxGetDlgItemStartFromHWND(pOccDlgInfo->m_pItemInfo[i].nId, hwndSearchFrom);
//If not found, revert to prev method of GetDlgItem, this means Win32 children list and
//resource item array are out of sync
if (hwndCtrl == NULL)
{
hwndCtrl = ::GetDlgItem(m_pWnd->GetSafeHwnd(),pOccDlgInfo->m_pItemInfo[i].nId);
TRACE(traceAppMsg, 0, "Warning: Resource items and Win32 Z-order lists are out of sync. Tab order may be not defined well.\n");
}
COleControlSiteOrWnd *pTemp =
new COleControlSiteOrWnd(
hwndCtrl,
pOccDlgInfo->m_pItemInfo[i].bAutoRadioButton);
ASSERT(IsWindow(pTemp->m_hWnd)); <===== H E R E
I note that hwndCtrl is NULL
If I launch the "ActiveX Control Test Container" application provided in the C++ samples with VS2008, I can insert this activex with no problem, while this application is also a MFC application!
In my basic MFC dialog-based application, I tried to insert other well known activex, like "adobe pdf reader", and "microsoft office spreadsheet", both worked.
So what could be wrong?
Thanks
Bookmarks