Results 1 to 4 of 4

Thread: QAxServer. How to embed QWidget into .NET forrm?

  1. #1
    Join Date
    May 2011
    Qt products
    MacOS X Unix/X11 Windows

    Default QAxServer. How to embed QWidget into .NET forrm?

    I try to embed ActiveQt sample into .NET form. The sample is QT_HOME\examples\activeqt\multiple (however the same situation is with any sample).

    The sample builds fine and works in IE and ActiveX Control Test Container. However when dragging it to a form the following error occurs:

    Failed to create component AxHost. The error message follows: 'System.Runtime.InteropServices.COMException (0x8002801D)': Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) at
    .... .NET stack trace follows.............

    Applies both to VS2008 and VS2010. Qt 4.7.4 and Qt 4.8.1.

    Does anyone knows how to resolve this issue? Thanks in advance.

    Kind regards, Ivan

  2. #2
    Join Date
    Nov 2012
    Qt products

    Default Re: QAxServer. How to embed QWidget into .NET forrm?


    I tried the same but into the most simple MFC application with VS2008 and it crashed!

    I wonder if anyone has already succeeded in using a QT activeX in a non-QT application?

  3. #3
    Join Date
    Mar 2009
    Brisbane, Australia
    Thanked 1,588 Times in 1,517 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows
    Wiki edits

    Default Re: QAxServer. How to embed QWidget into .NET forrm?

    Yes, it does work. I have seen some of the examples working embedded in Internet Explorer (as has the OP).

    Since neither of you has told us what you have actually done to make this work I will just guess:
    • The DLL output from your project build has to be registered with Windows using regsvr32. This is standard Active X/COM stuff and not Qt specific.
    • The DLL cannot be registered if it cannot load, and to do that the necessary Qt and C++ runtime libraries have to somewhere Windows can find them when it loads the DLL. If the DLL requires Qt plugins these must also be present. None of this is any different to deploying any Qt program on Windows and is covered in the docs and this forum routinely.

  4. #4
    Join Date
    Nov 2012
    Qt products

    Default Re: QAxServer. How to embed QWidget into .NET forrm?

    Here is how I proceed:
    - The directory containing the qt dlls is in the PATH
    - I build the qt example 'activeqt/simple' in VS2008 (launched from the 'Visual Studio with Qt 4.8.2' shortcut)
    - I registered the COM server with the cmd 'simpleax.exe /regserver'
    - In VS2008 (normal mode, not launched from Visual Studio with Qt 4.8.2 shortcut), I create a new MFC dialog-based application, with the "ActiveX controls" option checked on
    - in the main dialog resource view, I right-click and select the "Insert ActiveX control" menu item
    - In the "Insert ActiveX control" window list, I select the "QSimpleAX Class" item, and validate the dialog
    - There is a white window displayed now in the resource view
    - I launch the MFC application in debug mode: a failed assertion occurs in atlmfc\src\mfc\occcont.cpp:

    HWND hwndCtrl=AfxGetDlgItemStartFromHWND(pOccDlgInfo->m_pItemInfo[i].nId, hwndSearchFrom);
    //If not found, revert to prev method of GetDlgItem, this means Win32 children list and
    //resource item array are out of sync
    if (hwndCtrl == NULL)
    hwndCtrl = ::GetDlgItem(m_pWnd->GetSafeHwnd(),pOccDlgInfo->m_pItemInfo[i].nId);
    TRACE(traceAppMsg, 0, "Warning: Resource items and Win32 Z-order lists are out of sync. Tab order may be not defined well.\n");
    COleControlSiteOrWnd *pTemp =
    new COleControlSiteOrWnd(
    ASSERT(IsWindow(pTemp->m_hWnd)); <===== H E R E

    I note that hwndCtrl is NULL

    If I launch the "ActiveX Control Test Container" application provided in the C++ samples with VS2008, I can insert this activex with no problem, while this application is also a MFC application!

    In my basic MFC dialog-based application, I tried to insert other well known activex, like "adobe pdf reader", and "microsoft office spreadsheet", both worked.

    So what could be wrong?

    Last edited by d_d_v; 29th November 2012 at 13:06. Reason: updated contents

Similar Threads

  1. QAxServer:: Out of process executable server
    By Pharell in forum Qt Programming
    Replies: 3
    Last Post: 14th December 2012, 10:31
  2. Replies: 10
    Last Post: 11th June 2012, 09:16
  3. How to hide QAxServer details from .NET?
    By EgorSharin in forum Newbie
    Replies: 2
    Last Post: 16th February 2011, 22:50
  4. Linker error with QAxServer and QAxContainer
    By rajeshs in forum Qt Programming
    Replies: 1
    Last Post: 29th October 2008, 22:44
  5. Listening events of a QAxServer module
    By juan in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2008, 14:59


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.