Releasing window from other window (Qt)?



  • I work with Qt on VS2012. Part of my code contains intercepting other window (other app) that is working. I managed with intercepting, but when I want to release that window, I can't. Also when I shut down my app the other window should release and continue to work as a independent app (like it was before intercepting). Now that app is still working (in window task manager the process is still working) but there is no window visible.

    Part of my code that allows to intercept other window:

    @
    void MyApp::setWindow(const QString& name)
    {
    WId windowId = (WId) ::FindWindow(0, (TCHAR*)name.utf16());
    if(windowId != NULL)
    {
    childWindow = QWindow::fromWinId(windowId); //QWindow* childWindow
    childWidget = QWidget::createWindowContainer(childWindow); //QWidget* childWidget
    childWidget->setParent(mainWidget); //QWidget* mainwidget = ui.mainWidget;
    childWidget->show();
    }
    }
    @

    I have tried release it by setting parent as 0:

    @
    childWidget->setParent(0);
    @

    but it didn't work.

    Any idea how to do that?


  • Moderators

    Hi,

    Unfortunately there are multiple issues with capturing windows in Windows. See https://bugreports.qt-project.org/browse/QTBUG-40320

    Anyway, try childWindow->setParent(0) and then using the Windows API to set some more flags (see the workarounds in the link I gave)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.