Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. is there anyone familiar with COM? I met problem when changed project from MFC to Qt
Forum Updated to NodeBB v4.3 + New Features

is there anyone familiar with COM? I met problem when changed project from MFC to Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
29 Posts 6 Posters 3.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrjjM mrjj

    @opengpu
    did you get HRESULT hr out ?

    O Offline
    O Offline
    opengpu
    wrote on last edited by
    #19

    @mrjj HRESULT = -2147417850

    mrjjM 1 Reply Last reply
    0
    • O opengpu

      @mrjj HRESULT = -2147417850

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #20

      @opengpu
      ok. super. Hopefully mr hskoglund can get something out of that.

      1 Reply Last reply
      0
      • aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #21

        https://en.m.wikipedia.org/wiki/HRESULT describes tools to decode HRESULTs

        Qt has to stay free or it will die.

        1 Reply Last reply
        1
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #22

          @opengpu said in anyone familiar with COM? i met problem when changed project from MFC to Qt:

          -2147417850

          = 0x80010106

          https://stackoverflow.com/questions/11708497/com-library-initialization-failed-with-code-0x80010106-in-c-sharp

          "This is a bug in the DLL you are using. A DLL should never call CoInitializeEx() on a thread that it didn't create. "

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          3
          • hskoglundH Online
            hskoglundH Online
            hskoglund
            wrote on last edited by
            #23

            Hi, what happens to your .DLL if you skip (comment out) the call to CoInitializeEx()?

            O 1 Reply Last reply
            0
            • O Offline
              O Offline
              opengpu
              wrote on last edited by
              #24

              0x80010106

              1 Reply Last reply
              0
              • O Offline
                O Offline
                opengpu
                wrote on last edited by
                #25
                This post is deleted!
                1 Reply Last reply
                0
                • O Offline
                  O Offline
                  opengpu
                  wrote on last edited by
                  #26
                  #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;
                  }
                  
                  1 Reply Last reply
                  0
                  • O Offline
                    O Offline
                    opengpu
                    wrote on last edited by
                    #27
                    APIImp::APIImp()
                    {
                    	//if(!SUCCEEDED(CoInitialize(NULL)))
                    	HRESULT ret = CoInitializeEx(NULL, COINIT_MULTITHREADED);
                    	if(!SUCCEEDED(ret))
                    	{
                    		//return;
                    	}
                    
                    	initialize();
                    }
                    
                    1 Reply Last reply
                    0
                    • hskoglundH hskoglund

                      Hi, what happens to your .DLL if you skip (comment out) the call to CoInitializeEx()?

                      O Offline
                      O Offline
                      opengpu
                      wrote on last edited by
                      #28

                      @hskoglund why you asked this question?
                      i didnot return when failed to CoInitializeEx(NULL, COINIT_MULTITHREADED);
                      it seems worked...

                      1 Reply Last reply
                      0
                      • O Offline
                        O Offline
                        opengpu
                        wrote on last edited by
                        #29
                        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.

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved