Unsolved Calling a process in the main app and return the process's window ID?
-
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:
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?
-
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.
-
@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?
-
@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.