Important: Please read the Qt Code of Conduct -

Managing locations of multiple, separate applications from one

  • I have 2 applications, let's say a.exe and b.exe.

    Neither knows anything about the other.

    a.exe only knows the path of b.exe, using which it makes the call. No parameters or any other information is passed between the two.

    Now in case of multiple monitors, if I move a.exe over to another monitor, ideally b.exe should come in that screen too, but it would always launch in the primary.

    Knowing nothing else about b.exe, is it possible to somehow force it to launch in the same screen as a?

    a.exe code is in Qt/C++. b could very well be anything else.

    I had an idea to somehow make a.exe declare only a portion of the screen as legitimate and valid, so b would be forced to appear there. But I've no idea how to do this using Qt, if at all..

    Kindly advise. Thank you.

  • If b.exe is a console application you could use "QProcess": in a.exe and display the standard output in a window in a.exe.

  • Not a console application, I'm afraid.

    If I am able to pass parameters to the application, would that make a difference?

  • I do not know, if there is a solution for gui applications. This is not the area of my expertize. I guess you might be able to place the window of b.exe in close approximation or overlaying to the window of a.exe.
    However, your major topic is that you want to move both windows concurrently. I cannot imagine that this might be possible without exchanging much more information as you can pass through the command line. You would need to send signals on window movement from application to the other without knowing specifics.

  • That is the issue.

    After launching a.exe in one screen, I move it to the other in an extended screen setting.

    Now when I launch b.exe, calling it from a, I would like it to launch in the same screen as the one in which a currently sits.

    I do not pass anything over to b, except a couple of parameters regarding name. Neither can I modify b's code to accept some other parameters.

  • The mechanism to proper position the application (and other client applications) on multiscreen is based on the registration of the Windows Handle, for the application that has the focus.

    Is the window Handl HWND available for QT applications? If so, I can probably think of a workaround for this.

    Could someone help, please?

  • "QWidget::winId()": returns a platform-specific window handle, which is HWND on Windows.

  • Not being able to find any means.

    If someone could help me with this issue.

    How would I control or cause an application to launch in the same screen as another one, neither knowing anything about the other.

    Only the path and the name of the application is known to one, using which it launches the other.

    In a 4 screen arrangement or something, this causes havoc with the application positioning.

    Please help.

Log in to reply