Important: Please read the Qt Code of Conduct -

Translating C++ Excel RTD Server (DLL) to Qt ActiveX DLL Server

  • Hi,

    I have a Microsoft Office Excel RTD (real-time data) server in Visual C++ as a DLL (in-process server), and it works fine when I use it in Excel 2016.

    The issue is that I have to integrate it into an already existing Qt5 application (trading platform). The end-goal is to allow traders to import some data into excel and the data (obviously should be updated in near real-time).

    I've looked at this documentation, but it skims over instructions for building the server. I do not need ActiveX controls at least for now (which is sadly what most of the above link focuses on). It will just be a DLL that gives real-time data (on updateNotify()) to the cells that have an RTD call to it. Furthermore, my Qt5 project uses cMake as the build system, as opposed to qMake.

    I don't mind getting a stand-alone Qt5 version of this server up and running first, and then converting it into cMake (shouldn't be too difficult).

    I am having trouble with converting COM objects into Qt-like objects...

    For example:

    struct __declspec(uuid("a43788c1-d91b-11d3-8f39-00c04f3651b8"))
        IRTDUpdateEvent : IDispatch
        // Raw methods provided by interface
        virtual HRESULT __stdcall UpdateNotify() = 0;
        virtual HRESULT __stdcall get_HeartbeatInterval(
            /*[out,retval]*/ long* plRetVal) = 0;
        virtual HRESULT __stdcall put_HeartbeatInterval(
            /*[in]*/ long plRetVal) = 0;
        virtual HRESULT __stdcall Disconnect() = 0;
    struct __declspec(uuid("ec0e6191-db51-11d3-8f3e-00c04f3651b8"))
        IRtdServer : IDispatch
        // Raw methods provided by interface
        virtual HRESULT __stdcall ServerStart(
            /*[in]*/ struct IRTDUpdateEvent* CallbackObject,
            /*[out,retval]*/ long* pfRes) = 0;
        virtual HRESULT __stdcall ConnectData(
            /*[in]*/ long TopicID,
            /*[in]*/ SAFEARRAY** Strings,
            /*[in,out]*/ VARIANT_BOOL* GetNewValues,
            /*[out,retval]*/ VARIANT* pvarOut) = 0;
        virtual HRESULT __stdcall RefreshData(
            /*[in,out]*/ long* TopicCount,
            /*[out,retval]*/ SAFEARRAY** parrayOut) = 0;
        virtual HRESULT __stdcall DisconnectData(
            /*[in]*/ long TopicID) = 0;
        virtual HRESULT __stdcall Heartbeat(
            /*[out,retval]*/ long* pfRes) = 0;
        virtual HRESULT __stdcall ServerTerminate() = 0;

    My server is essentially based off of this, with minor differences.

    Any help would be greatly appreciated.