Important: Please read the Qt Code of Conduct -

Using .NET dll via QT

  • I am hardly trying to use Laser Control dll file based on .NET on QT.
    I registered dll file on server, made tlb file, and imported it with using command

    @ #import "Litron.Control.CWLasers.tlb" no_namespace named_guids @

    after that, I used this command


    struct cwDiodeLaserPIV;
    cwDiodeLaserPIV Laser=NULL;
    HRESULT hr = CoCreateInstance(CLSID_cwDiodeLaserPIV, NULL, CLSCTX_INPROC_SERVER, IID__cwDiodeLaserPIV, reinterpret_cast<void

    @ *I added ActiveQT header file also to use CoCreateInstance

    when i Check whether this code works with this,

    { qDebug()<<"Calling dll is succeded"; }
    { qDebug()<<"Calling dll is failed"; }

    "Calling dll is failed" is come out.
    But, When i use same code in Visual Studio C++, "Calling dll is succeded" is come out.
    furthermore, even calling dll is succeeded, I couldn't call the function of dll at VS.

    Here are some Questions.

    1. I used struct cwDiodeLaserPIV. because in tlh file, cwDiodeLaserPIV is declared with struct command.
      but actually, when i see the inner part of dll, cwDiodeLaserPIV was declared with class command.
      Why this happen? Can I use it with struct declaration?

    2. When I write down the code at QT, CLSID_ and IID_ part, There were no directory that automatically connected.
      On the Other hand, at VS, CLSID_cwDiodeLaserPIV and IID__cwDiodeLaserPIV are automatically found by VS
      Say again, at QT, CLSID_cwDiodeLaserPIV and IID__cwDiodeLaserPIV are not found in list of directory that automatically connected when i write down CLSID_ or IID_. Why this happen? Can 't I use this way at QT?

    ++ I refered and made cpp and header file using dumpcpp. but it seems there aren't enough function in it.

    I am such a vanilla on QT and Programming. So, example code would be very helpful
    Thanks very much...

  • Moderators

    I believe you're looking for this:
    Disclaimer: I haven't worked with it.

  • @Bean_Noodle
    From @kshegunov's link, in the Examples you'll want to look at

  • Moderators

    I'd say is a much better hit. As far as I can tell the OP wants to embed a COM object into a Qt application.

Log in to reply