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.1k 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.
  • O Offline
    O Offline
    opengpu
    wrote on last edited by
    #9

    @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();
    }
    
    1 Reply Last reply
    0
    • O Offline
      O Offline
      opengpu
      wrote on last edited by
      #10
      class APIImp {
      private:
      DataCOMLib::_DataCOMPtr	m_pData;
      
      1 Reply Last reply
      0
      • O Offline
        O Offline
        opengpu
        wrote on last edited by
        #11

        CppAPIImp::initialize()
        {
        CreateInstance(__uuidof(DataCOMLib::DataCOM), NULL, CLSCTX_ALL);
        QueryInterface
        FindConnectionPoint
        QueryInterface
        Advise

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

          APIImp::release()
          {
          cancelRequest
          Unadvise
          Release

          1 Reply Last reply
          0
          • hskoglundH Online
            hskoglundH Online
            hskoglund
            wrote on last edited by
            #13

            Hi, what error do you get from your CoInitializeEx() call? Try something like:

            HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
            qDebug() << hr;
            
            
            O 1 Reply Last reply
            2
            • hskoglundH hskoglund

              Hi, what error do you get from your CoInitializeEx() call? Try something like:

              HRESULT hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
              qDebug() << hr;
              
              
              O Offline
              O Offline
              opengpu
              wrote on last edited by
              #14

              @hskoglund that DLL with COM is not Qt program...

              mrjjM 1 Reply Last reply
              0
              • O opengpu

                @hskoglund that DLL with COM is not Qt program...

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

                @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?

                1 Reply Last reply
                2
                • O Offline
                  O Offline
                  opengpu
                  wrote on last edited by
                  #16

                  the DLL is the same...
                  and i wiil log out the errorcode

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

                    anyone familiar ?

                    mrjjM 1 Reply Last reply
                    0
                    • O opengpu

                      anyone familiar ?

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

                      @opengpu
                      did you get HRESULT hr out ?

                      O 1 Reply Last reply
                      0
                      • 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

                                          • Login

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