Unsolved is there anyone familiar with COM? I met problem when changed project from MFC to Qt
-
@opengpu
did you get HRESULT hr out ? -
@mrjj HRESULT = -2147417850
-
@opengpu
ok. super. Hopefully mr hskoglund can get something out of that. -
https://en.m.wikipedia.org/wiki/HRESULT describes tools to decode HRESULTs
-
@opengpu said in anyone familiar with COM? i met problem when changed project from MFC to Qt:
-2147417850
= 0x80010106
"This is a bug in the DLL you are using. A DLL should never call CoInitializeEx() on a thread that it didn't create. "
-
Hi, what happens to your .DLL if you skip (comment out) the call to CoInitializeEx()?
-
0x80010106
-
This post is deleted! -
#include "stdafx.h" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }
-
APIImp::APIImp() { //if(!SUCCEEDED(CoInitialize(NULL))) HRESULT ret = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(!SUCCEEDED(ret)) { //return; } initialize(); }
-
@hskoglund why you asked this question?
i didnot return when failed to CoInitializeEx(NULL, COINIT_MULTITHREADED);
it seems worked... -
APIImp::APIImp() { //if(!SUCCEEDED(CoInitialize(NULL))) HRESULT ret = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if(!SUCCEEDED(ret)) { return; } initialize(); }
i use COINIT_APARTMENTTHREADED instead of COINIT_MULTITHREADED, and this works fine for me.