Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Calling a process in the main app and return the process's window ID?

Calling a process in the main app and return the process's window ID?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lansing
    wrote on last edited by lansing
    #1

    Re: Chrome like tab with separate process for each?

    This is a continuation of my old thread above about creating a multi tab app with separate processes. The advice was to use QSharedMemory to handle the passing of data between the processes.

    So far I created a main app and a child app with Qt, in the main app there's a button, when clicked, opens a new process window of the child app. And I can successfully pass data from the main to the child through QSharedMemory.

    Right now I want to embed the child windows into the main app window. This is the code I found that best suit for this using WinID and createWindowContainer:

    source

    QWindow *window = QWindow::fromWinId(211812356);
    window->setFlags(Qt::FramelessWindowHint);
    
    QWidget *widget = QWidget::createWindowContainer(window);
    
    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(widget);
    this->setLayout(layout);
    

    The problem I have is that I don't know how to get the window id of child process after I opened them. The only way I found is to get it by specifying the exact name of the process in the process list, but this will not work for me because all my child processes have the same name. What I'm thinking is to have my child app passes its winId to the sharedmemory on initiation, and then retrieve it in my main app? Is this the correct way to do it?

    1 Reply Last reply
    0
    • Kent-DorfmanK Online
      Kent-DorfmanK Online
      Kent-Dorfman
      wrote on last edited by
      #2

      In my scenario I give the winId of the display window to the child process upon startup of the child QProcess. The main Qt program creates and manages the windows, and the child spawned processes receive and use the winId given to them.

      If you meet the AI on the road, kill it.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lansing
        wrote on last edited by
        #3

        @Kent-Dorfman said in Calling a process in the main app and return the process's window ID?:

        In my scenario I give the winId of the display window to the child process upon startup of the child QProcess. The main Qt program creates and manages the windows, and the child spawned processes receive and use the winId given to them.

        I don't get it, so you have three components? The display window, the main program and the child processes? How are they connected?

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @lansing said in Calling a process in the main app and return the process's window ID?:

          The problem I have is that I don't know how to get the window id of child process after I opened them.

          You create them, you communicate with them through shared memory and you've access to it's QProcess and therefore to it's stdout pipe - I think these are enough communication channels to pass the winid.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved