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. Using .NET dll via QT
Forum Updated to NodeBB v4.3 + New Features

Using .NET dll via QT

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 643 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.
  • B Offline
    B Offline
    Bean_Noodle
    wrote on last edited by
    #1

    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;
    CoInitialize(NULL);
    HRESULT hr = CoCreateInstance(CLSID_cwDiodeLaserPIV, NULL, CLSCTX_INPROC_SERVER, IID__cwDiodeLaserPIV, reinterpret_cast<void
    *>(&Laser));

    @ *I added ActiveQT header file also to use CoCreateInstance

    when i Check whether this code works with this,

    @
    if(SUCCEEDED(hr))
    { qDebug()<<"Calling dll is succeded"; }
    else
    { 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 https://forum.qt.io/topic/108642/how-to-include-a-com-tlb-library-in-my-c-project/2 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...

    kshegunovK JonBJ 2 Replies Last reply
    0
    • B Bean_Noodle

      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;
      CoInitialize(NULL);
      HRESULT hr = CoCreateInstance(CLSID_cwDiodeLaserPIV, NULL, CLSCTX_INPROC_SERVER, IID__cwDiodeLaserPIV, reinterpret_cast<void
      *>(&Laser));

      @ *I added ActiveQT header file also to use CoCreateInstance

      when i Check whether this code works with this,

      @
      if(SUCCEEDED(hr))
      { qDebug()<<"Calling dll is succeded"; }
      else
      { 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 https://forum.qt.io/topic/108642/how-to-include-a-com-tlb-library-in-my-c-project/2 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...

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      I believe you're looking for this: https://doc.qt.io/qt-5/activeqt-index.html
      Disclaimer: I haven't worked with it.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      1
      • B Bean_Noodle

        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;
        CoInitialize(NULL);
        HRESULT hr = CoCreateInstance(CLSID_cwDiodeLaserPIV, NULL, CLSCTX_INPROC_SERVER, IID__cwDiodeLaserPIV, reinterpret_cast<void
        *>(&Laser));

        @ *I added ActiveQT header file also to use CoCreateInstance

        when i Check whether this code works with this,

        @
        if(SUCCEEDED(hr))
        { qDebug()<<"Calling dll is succeded"; }
        else
        { 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 https://forum.qt.io/topic/108642/how-to-include-a-com-tlb-library-in-my-c-project/2 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...

        JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by JonB
        #3

        @Bean_Noodle
        From @kshegunov's link, in the Examples you'll want to look at https://doc.qt.io/qt-5/activeqt-dotnet.html.

        kshegunovK 1 Reply Last reply
        2
        • JonBJ JonB

          @Bean_Noodle
          From @kshegunov's link, in the Examples you'll want to look at https://doc.qt.io/qt-5/activeqt-dotnet.html.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #4

          I'd say https://doc.qt.io/qt-5/activeqt-container.html is a much better hit. As far as I can tell the OP wants to embed a COM object into a Qt application.

          Read and abide by the Qt Code of Conduct

          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