Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to set focus on different application?



  • Hi i have a button on my gui. When ever am clicking button, i need to set focus to already playing VLC media player.
    So am unable to figure it out. how to set focus to different application by button click.


  • Lifetime Qt Champion

    Hi
    You cannot do that with Qt as far as I know. You must use your platforms API
    to find the window and set focus to it.
    Do note that Windows 10 might not allow you to do so if VLC players is not in foreground.

    Can I ask what you try to do ? / what task is.



  • Hi mrji, Actually i want to handle VLC media player(start,stop,pause) through Qt application.
    When i click start button in Qt application it should replicate in VLC player. same as for stop and pause.
    Both VLC and Qt application will running at same. When i click start button in QT application, i need to set focus to VLC player and start playing music.


  • Lifetime Qt Champion

    @Shankar-B

    Hi
    You will have to use Windows API for that. We cannot just all setFoucs in other app with pure Qt.

    However, there might be a better way

    https://forum.videolan.org/viewtopic.php?t=6065

    I would go and find out if that
    rc interface
    is still available


Log in to reply