Unsolved is there anyone familiar with COM? I met problem when changed project from MFC to Qt
-
is there anyone familiar with COM? I met problem when changed project from MFC to Qt .
the MFC exe depends on a dll which use COM -
Hi,
You should give more details about what you are using and how you are using it.
-
in that dll, it fail to CoInitializeEx
APIImp::APIImp():m_pData(NULL) { //if(!SUCCEEDED(CoInitialize(NULL))) if(!SUCCEEDED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) { assert(0 && "fail to CoInitializeEx"); return; }
-
So it's a dll you have control over ?
-
yes, i have the dll project, and i added that assert.
but i donot think i can change the code. -
why CoInitializeEx fail in tha DLL? it works in MFC app, and i also donot see anything init or special work.
sorry, i am not quite familia with COM -
@SGaist better donot change the DLL code...
-
Do you have several calls to CoInitializeEx ?
Are you properly calling CoUninitialize when you're done with your COM stuff ? -
@SGaist said in anyone familiar with COM? i met problem when changed project from MFC to Qt:
CoInitializeEx
just one time in DLL
APIImp::~APIImp() { release(); CoUninitialize(); }
-
class APIImp { private: DataCOMLib::_DataCOMPtr m_pData;
-
CppAPIImp::initialize()
{
CreateInstance(__uuidof(DataCOMLib::DataCOM), NULL, CLSCTX_ALL);
QueryInterface
FindConnectionPoint
QueryInterface
Advise -
APIImp::release()
{
cancelRequest
Unadvise
Release -
Hi, what error do you get from your CoInitializeEx() call? Try something like:
HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); qDebug() << hr;
-
@hskoglund that DLL with COM is not Qt program...
-
@opengpu
Hi
then use std::cout to show the HRESULT.
It can give hints about why its not loading,.What im a bit puzzled about if that is the same DLL used in the MFC app, and you did not change
the actual DLL code. why should it then stop working? -
the DLL is the same...
and i wiil log out the errorcode -
anyone familiar ?
-
@opengpu
did you get HRESULT hr out ? -
@mrjj HRESULT = -2147417850
-
@opengpu
ok. super. Hopefully mr hskoglund can get something out of that.