What is the intention of making these methods mandatory while creating COM object in QT.



  • Hi,

    I've created some COM object based on the post "11533":http://developer.qt.nokia.com/forums/viewthread/11533/.

    At present I've used the "ActiveQt Server" template for creating a COM object, which generated some *.tlb file. So, its easy now from Qt perspective.

    Now I want something more;

    While creating the COM project by using the respective template as mentioned above, I got error by not including below respective methods,

    @
    ULONG STDMETHODCALLTYPE AddRef( void);
    ULONG STDMETHODCALLTYPE Release( void);
    STDMETHOD(QueryInterface)(
    /* [in] / REFIID riid,
    /
    [iid_is][out] */ __RPC__deref_out void __RPC_FAR *__RPC_FAR *ppvObject);
    @

    I don't understand what this mean to be from QT perspective, this came form "unknwn.h" , which seems to be Microsoft SDK file.Below shows similar error of not including AddRef() ,

    @
    classA.cpp(103): error C2259: 'ClassA' : cannot instantiate abstract class
    due to following members:
    1> 'ULONG IUnknown::AddRef(void)' : is abstract
    1> C:\Program Files\Microsoft SDKs\Windows\v7.0A\include\unknwn.h(120) : see declaration of 'IUnknown::AddRef'
    @

    My "classA" is derving some 3rd party abstract class, in order to implement it in my class , "classA". So, I don't understand why to include those methods or is that necessary to include it.



  • If you need these methods, depends, how you implement you class. As you don't show your code, itÄs hard to say.
    In COM in general, all interfaces are derived from IUnknown, which defines these methods.



  • Hi,

    Well, as you said "how you implement your class" , this is excatly what I needed. As I'm new to C++ concepts & Qt, I'm not getting understanding it properly.

    I've captured that here "11533":http://developer.qt.nokia.com/forums/viewthread/11533/

    "scanner" class is the 3rd party dll and it will be calling my COM dll.

    One basic doubt is like , is that the 3rd party class which I'm deriving will be qurering my COM dll for the fundtion signature, is that for this case its useful.

    Waiting for reply,

    Thanks,


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.