Program is running in command line mode and another instance is launched!?



  • Hello Developers :D

    I have developed an application that takes command-line arguments.
    The application has the ability to focus to the already running application if another instance is launched, by sending a message from the launched (new) application to the already open application.
    So, the problem is that if the program is running with a command line argument (something that does not open the GUI, it runs in the console) and another instance is launched I don't know what to do exactly...
    The argument is running a function every 30min using a qtimer and does nothing else actually, so, should I have the app connected and ready to receive a signal and when it receive it from the another instance to call the w.show(); (where w is MainWindow w;) and stop the command line-mode and its functionality (also maybe display a message that the process X has stopped because another instance was launched) ?

    I think that this is what I should do but not sure, and I don't want to do something wrong and have to correct it afterwards... (also by doing my way of thinking, MainWindow w; should be global)

    So, what would be your way to do it, or what do you expect to be the behaviour of a program if it had a command-line interface and GUI was called?

    Thanks :)


  • Moderators



  • Thank Tobias for the answer!
    No! The problem is specific :)
    I have my own (really safe, no files used) way to check if my application is running.

    I don't need this.

    I want your opinion about what would you have done in an occassion where your program was running in non-GUI mode and GUI was called, and briefly how would you do it (I have mentioned my way in the 1st post)


Log in to reply
 

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