C++ (Qt)QWidget *w = new QWidget();w->setAttribute(Qt::WA_NativeWindow, true);SetParent((HWND)w->winId(), (HWND)parentHandle);w->show();
C++ (Qt)long style = GetWindowLong((HWND)w->winId(), GWL_EXSTYLE);style &= ~WS_EX_MDICHILD;SetWindowLong((HWND)w->winId(), GWL_STYLE, style);
C++ (Qt)QWidget *carrier = new QWidget();Widget *w = new Widget(carrier);EnableWindow((HWND)parentHandle, false);w->show();QEventLoop loop;w->connect(w, SIGNAL(closed()), &loop, SLOT(quit()));loop.exec();delete w;delete carrier;EnableWindow((HWND)parentHandle, true);SetFocus((HWND)parentHandle);
C++ (Qt)virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *) override { if(eventType == "windows_generic_MSG") { const MSG *msg = reinterpret_cast<MSG *>(message); if(msg->message == WM_SETFOCUS && w) w->activateWindow(); } return false; }