diff --git a/examples/widgets/desktop/systray/main.cpp b/examples/widgets/desktop/systray/main.cpp
index 95c527a..2f82a42 100644
--- a/examples/widgets/desktop/systray/main.cpp
+++ b/examples/widgets/desktop/systray/main.cpp
@@ -39,10 +39,13 @@
 ****************************************************************************/
 
 #include <QApplication>
+#include <QClipboard>
 
 #ifndef QT_NO_SYSTEMTRAYICON
 
 #include <QMessageBox>
+#include <QDebug>
+#include <QStringList>
 #include "window.h"
 
 int main(int argc, char *argv[])
@@ -50,6 +53,9 @@ int main(int argc, char *argv[])
     Q_INIT_RESOURCE(systray);
 
     QApplication app(argc, argv);
+    QStringList args = QCoreApplication::arguments();
+    args.pop_front();
+    qDebug() << QT_VERSION_STR << args;
 
     if (!QSystemTrayIcon::isSystemTrayAvailable()) {
         QMessageBox::critical(0, QObject::tr("Systray"),
@@ -60,8 +66,18 @@ int main(int argc, char *argv[])
     QApplication::setQuitOnLastWindowClosed(false);
 
     Window window;
-    window.show();
-    return app.exec();
+    if (args.contains("-w")) {
+        window.show();
+        const QString hwndS = ("0x" + QString::number(window.winId(), 16));
+        qApp->clipboard()->setText(hwndS);
+        qDebug() << __FUNCTION__ << "Copied HWND" << hwndS;
+    } else {
+        qDebug() << "no window";
+    }
+
+    int r =app.exec();
+    qDebug() << "ret" << r;
+    return r;
 }
 
 #else
diff --git a/examples/widgets/desktop/systray/systray.pro b/examples/widgets/desktop/systray/systray.pro
index 1d4fdc7..0a8c769 100644
--- a/examples/widgets/desktop/systray/systray.pro
+++ b/examples/widgets/desktop/systray/systray.pro
@@ -4,7 +4,7 @@ SOURCES       = main.cpp \
 RESOURCES     = systray.qrc
 
 QT += widgets
-
+CONFIG+=console
 # install
 target.path = $$[QT_INSTALL_EXAMPLES]/widgets/desktop/systray
 INSTALLS += target
diff --git a/examples/widgets/desktop/systray/window.cpp b/examples/widgets/desktop/systray/window.cpp
index f13c057..7af7ede 100644
--- a/examples/widgets/desktop/systray/window.cpp
+++ b/examples/widgets/desktop/systray/window.cpp
@@ -60,6 +60,7 @@
 //! [0]
 Window::Window()
 {
+    setWindowFlags(windowFlags() | Qt::CustomizeWindowHint | Qt::WindowMinMaxButtonsHint);
     createIconGroupBox();
     createMessageGroupBox();
 
@@ -226,6 +227,10 @@ void Window::createMessageGroupBox()
     showMessageButton = new QPushButton(tr("Show Message"));
     showMessageButton->setDefault(true);
 
+    QPushButton *b = new QPushButton(tr("Hide"));
+    connect(b, SIGNAL(clicked()), this, SLOT(hide()));
+
+
     QGridLayout *messageLayout = new QGridLayout;
     messageLayout->addWidget(typeLabel, 0, 0);
     messageLayout->addWidget(typeComboBox, 0, 1, 1, 2);
@@ -236,7 +241,8 @@ void Window::createMessageGroupBox()
     messageLayout->addWidget(titleEdit, 2, 1, 1, 4);
     messageLayout->addWidget(bodyLabel, 3, 0);
     messageLayout->addWidget(bodyEdit, 3, 1, 2, 4);
-    messageLayout->addWidget(showMessageButton, 5, 4);
+    messageLayout->addWidget(b, 5, 4);
+    messageLayout->addWidget(showMessageButton, 6, 4);
     messageLayout->setColumnStretch(3, 1);
     messageLayout->setRowStretch(4, 1);
     messageGroupBox->setLayout(messageLayout);
diff --git a/examples/widgets/mainwindows/mdi/main.cpp b/examples/widgets/mainwindows/mdi/main.cpp
index d454f52..8efb7b4 100644
--- a/examples/widgets/mainwindows/mdi/main.cpp
+++ b/examples/widgets/mainwindows/mdi/main.cpp
@@ -39,6 +39,8 @@
 ****************************************************************************/
 
 #include <QApplication>
+#include <QDebug>
+#include <QClipboard>
 #include <QCommandLineParser>
 #include <QCommandLineOption>
 
@@ -61,5 +63,8 @@ int main(int argc, char *argv[])
     foreach (const QString &fileName, parser.positionalArguments())
         mainWin.openFile(fileName);
     mainWin.show();
+    const QString hwndS = ("0x" + QString::number(mainWin.winId(), 16));
+    qApp->clipboard()->setText(hwndS);
+    qDebug() << __FUNCTION__ << "Copied HWND" << hwndS;
     return app.exec();
 }
diff --git a/examples/widgets/mainwindows/mdi/mdi.pro b/examples/widgets/mainwindows/mdi/mdi.pro
index 2e3c232..6c396b8 100644
--- a/examples/widgets/mainwindows/mdi/mdi.pro
+++ b/examples/widgets/mainwindows/mdi/mdi.pro
@@ -6,7 +6,7 @@ SOURCES       = main.cpp \
                 mainwindow.cpp \
                 mdichild.cpp
 RESOURCES     = mdi.qrc
-
+CONFIG += console
 # install
 target.path = $$[QT_INSTALL_EXAMPLES]/widgets/mainwindows/mdi
 INSTALLS += target
