diff --git a/examples/activeqt/hierarchy/objects.cpp b/examples/activeqt/hierarchy/objects.cpp
index 1cb59ae..bfcbedd 100644
--- a/examples/activeqt/hierarchy/objects.cpp
+++ b/examples/activeqt/hierarchy/objects.cpp
@@ -41,6 +41,8 @@
 #include "objects.h"
 #include <QLayout>
 #include <QPainter>
+#include <QLabel>
+#include <QLibraryInfo>
 
 /* Implementation of QParentWidget */
 //! [0]
@@ -48,6 +50,7 @@ QParentWidget::QParentWidget(QWidget *parent)
 : QWidget(parent)
 {
     vbox = new QVBoxLayout(this);
+    vbox->addWidget(new QLabel(QLibraryInfo::build()));
 }
 
 //! [0] //! [1]
diff --git a/examples/activeqt/simple/main.cpp b/examples/activeqt/simple/main.cpp
index 2c86d97..eaac440 100644
--- a/examples/activeqt/simple/main.cpp
+++ b/examples/activeqt/simple/main.cpp
@@ -42,6 +42,8 @@
 #include <QAxFactory>
 #include <QApplication>
 #include <QLayout>
+#include <QLibraryInfo>
+#include <QLabel>
 #include <QSlider>
 #include <QLCDNumber>
 #include <QLineEdit>
@@ -57,8 +59,10 @@ public:
     QSimpleAX(QWidget *parent = 0)
     : QWidget(parent)
     {
+        qDebug(__FUNCTION__);
         QVBoxLayout *vbox = new QVBoxLayout( this );
 
+
         slider = new QSlider( Qt::Horizontal, this );
         LCD = new QLCDNumber( 3, this );
         edit = new QLineEdit( this );
@@ -66,6 +70,7 @@ public:
         connect( slider, &QAbstractSlider::valueChanged, this, &QSimpleAX::setValue );
         connect( edit, &QLineEdit::textChanged, this, &QSimpleAX::setText );
 
+        vbox->addWidget(new QLabel(QLibraryInfo::build()));
         vbox->addWidget( slider );
         vbox->addWidget( LCD );
         vbox->addWidget( edit );
diff --git a/examples/activeqt/simple/simple.pro b/examples/activeqt/simple/simple.pro
index 33d5410..c37d507 100644
--- a/examples/activeqt/simple/simple.pro
+++ b/examples/activeqt/simple/simple.pro
@@ -1,9 +1,11 @@
 include(../shared.pri)
 
-TEMPLATE = app
+TEMPLATE = lib
+
 TARGET   = simpleax
 
-CONFIG += warn_off
+
+CONFIG += warn_off dll
 QT += widgets axserver
 
 SOURCES  = main.cpp
diff --git a/src/activeqt/control/qaxserver.cpp b/src/activeqt/control/qaxserver.cpp
index 35a32dd..3e7f17a 100644
--- a/src/activeqt/control/qaxserver.cpp
+++ b/src/activeqt/control/qaxserver.cpp
@@ -88,6 +88,7 @@ QAxFactory *qAxFactory()
         // QAxFactory created a QApplication
         if (!hadQApp && qApp)
             qax_ownQApp = true;
+        qDebug() << __FUNCTION__ << "qax_ownQApp=" << qax_ownQApp;
 
         // register all types with metatype system as pointers
         QStringList keys(qax_factory->featureList());
diff --git a/src/activeqt/control/qaxserverbase.cpp b/src/activeqt/control/qaxserverbase.cpp
index 61645fd..c5d0db5 100644
--- a/src/activeqt/control/qaxserverbase.cpp
+++ b/src/activeqt/control/qaxserverbase.cpp
@@ -903,7 +903,8 @@ public:
         if (!qApp) {
             qax_ownQApp = true;
             int argc = 0;
-            new QApplication(argc, 0);
+            QApplication *app = new QApplication(argc, 0);
+            qDebug() << __FUNCTION__ << "created" << app << "qax_ownQApp=" << qax_ownQApp;
         }
         QGuiApplication::setQuitOnLastWindowClosed(false);
 
diff --git a/src/activeqt/control/qaxserverdll.cpp b/src/activeqt/control/qaxserverdll.cpp
index 7117cbb..8e8fa11 100644
--- a/src/activeqt/control/qaxserverdll.cpp
+++ b/src/activeqt/control/qaxserverdll.cpp
@@ -42,6 +42,7 @@
 #include <private/qcoreapplication_p.h>
 #include <qwidget.h>
 #include <qdir.h>
+#include <qdebug.h>
 
 #include <qt_windows.h>
 
@@ -88,12 +89,20 @@ STDAPI DllGetClassObject(const GUID &clsid, const GUID &iid, void** ppv)
 
 STDAPI DllCanUnloadNow()
 {
-    if (GetCurrentThreadId() != qAxThreadId)
+    qDebug() << __FUNCTION__  << "qax_ownQApp=" << qax_ownQApp;
+    if (GetCurrentThreadId() != qAxThreadId) {
+        qDebug() << __FUNCTION__  << "ret1: other thread";
         return S_FALSE;
-    if (qAxLockCount())
+    }
+    if (unsigned long lc = qAxLockCount()) {
+        qDebug() << __FUNCTION__  << "ret2: qAxLockCount=" << lc;
         return S_FALSE;
-    if (!qax_ownQApp)
+    }
+
+    if (!qax_ownQApp) {
+        qDebug() << __FUNCTION__  << "ret2: !qax_ownQApp";
         return S_OK;
+    }
 
     // check if qApp still runs widgets (in other DLLs)
     QWidgetList widgets = QApplication::allWidgets();
@@ -111,10 +120,12 @@ STDAPI DllCanUnloadNow()
     if (qax_hhook)
         UnhookWindowsHookEx(qax_hhook);
 
+    qDebug() << __FUNCTION__ << "del" << qApp;
     delete qApp;
     qax_ownQApp = false;
 
     // never allow unloading - safety net for Internet Explorer
+    qDebug() << __FUNCTION__ << "Fallthrough S_FALSE";
     return S_FALSE;
 }
 
