Results 1 to 11 of 11

Thread: How to command other process?

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default How to command other process?

    Hello!

    I want to create a software that externaly controls other softwares. I know that QProcess is certanly a class that I'm gonna use sometime, but given what I read on its help files I'm not sure it has what I need:

    * the possibility to check if the process is running or stoped (stoped == stoped or simply 'not answering')
    * the possibility to manipulate the software without having to start it by my software (in other words, I should be able to run it, stop it, command it etc. while not having to start it by my application; it should rather start by the user's choice, and as far as I know QProcess only allows for the user to command the software in question if that one is started with QProcess)
    * the possiblity to see the software's parameters (such as how much RAM memory it's consuming)
    * (I think the most difficult part) To see if the software is currently being used (i.e. the user is doing something with it) or it is simply opened, with nobody actually using it.

    So can I do all this with QProcess (as far as I know, not)? In case the answer being "no", what more will I have to use? And in case "yes", how exactly should I do it? (Because I couldn't figured it out).


    Thanks!

    Momergil
    Last edited by Momergil; 26th June 2012 at 15:24.

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to command other process?

    you are correct - you cannot do all of that with QProcess. I'm not sure you can even do it with Qt.

    I think you will have to look elsewhere for process attaching and process resource info
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to command other process?

    Well, that's not good news. But what of my list can I do with QProcess?

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to command other process?

    if we ignore 'not answering' because it doesn't mean much, then QProcess can tell you if a process has stopped or not. And thats it.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to command other process?

    he possibility to manipulate the software without having to start it by my software (in other words, I should be able to run it, stop it, command it etc. while not having to start it by my application;
    I am puzzled how you can expect to "be able to run it" without starting it with your application. Is this some unusual interpretation of "run it"?

    Anyway to control an entire machine full of foreign processes, which is what you are asking for, is inherently platform specific and intimately tied to security model of the operating system allowing you to do this. You will have to use the appropriate operating system API to do the vast majority of what you ask.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to command other process?

    Provided that the other application was written using Qt and provided that you are able to inject some code into the application, it might be possible to do most of what you want with Qt. However, as Chris mentioned, this is very platform specific.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to command other process?

    if we ignore 'not answering' because it doesn't mean much, then QProcess can tell you if a process has stopped or not. And thats it.
    Actually, it means to me :P I have to know if a process ist not answering for a good time, so my app will reset it. Now, how exactly can I know if a process has stopped or not with QProcess?

    I am puzzled how you can expect to "be able to run it" without starting it with your application. Is this some unusual interpretation of "run it"?
    hehe, I guess yes! xD Essentially: I must be able to have entire control over the software (as far as it allows me, of course) without having any dependency of that one over my app (so, e.g., if my app crashes and is closed, that software will continue working as if nothing happened since there must be no dependecies, only momentarely interventions).

    Anyway to control an entire machine full of foreign processes, which is what you are asking for, is inherently platform specific and intimately tied to security model of the operating system allowing you to do this. You will have to use the appropriate operating system API to do the vast majority of what you ask.
    Hmm, as I was figuring out.

    Provided that the other application was written using Qt and provided that you are able to inject some code into the application, it might be possible to do most of what you want with Qt. However, as Chris mentioned, this is very platform specific.
    Actually, at least for the time being, it's not written in Qt. But I imagine that this app will be later transformed into one that should have no IDE limitations.

    -------
    Conclusion, then:

    It's better to forget using QProcess, because even if I use it I'll not be able to do everything I want with it, so I'll have to use the OS API anyway - so better write evertyhing using the API functions.

    So now the only problem is to make that work (http://www.qtcentre.org/threads/4969...-quot?p=223231).


    Well, thanks!


    Momergil

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to command other process?

    Quote Originally Posted by Momergil View Post
    I have to know if a process ist not answering for a good time
    Not answering to whom?

    Now, how exactly can I know if a process has stopped or not with QProcess?
    QProcess will emit the finished() signal when the inferior exits.


    Actually, at least for the time being, it's not written in Qt.
    In that case I have no idea why are you asking those questions on a Qt forum.

    But I imagine that this app will be later transformed into one that should have no IDE limitations.
    I don't see what IDE has anything to do with this.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to command other process?

    Not answering to whom?
    You know, when you are using Windows and suddently the software in use don't answer anymore, you click it with the mouse or try keyboard shortcuts and nothing happends, than the up-border bar put "... (Not Responding)".

    In that case I have no idea why are you asking those questions on a Qt forum.
    The software I initially want to communicate with is not written in Qt, but the software I want to create and that will have this control over the other will be written in Qt.

    I don't see what IDE has anything to do with this.
    Well, you sad:
    Provided that the other application was written using Qt (...)
    , what seems to mean that IDE do have something to do with this

  10. #10
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to command other process?

    what seems to mean that IDE do have something to do with this
    How so?
    You can develop Qt applications with a text editor, and a command line.
    IDE is not necessary at all, and you can use any available IDE you like.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  11. #11
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to command other process?

    Quote Originally Posted by Momergil View Post
    You know, when you are using Windows and suddently the software in use don't answer anymore, you click it with the mouse or try keyboard shortcuts and nothing happends, than the up-border bar put "... (Not Responding)".
    And the technical definition of the situation is...?

    The software I initially want to communicate with is not written in Qt, but the software I want to create and that will have this control over the other will be written in Qt.
    But you want to instrument that other software and you need to know how to do it. I don't understand why people expect Qt to be a swiss army knife that has built-in solutions for everything. It's an application framework, for God's sake...


    Well, you sad:
    , what seems to mean that IDE do have something to do with this
    "Qt" is a "library" (or actually a set of them), not an "IDE".
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 7
    Last Post: 20th October 2012, 13:44
  2. Replies: 3
    Last Post: 23rd February 2011, 08:50
  3. Replies: 4
    Last Post: 14th July 2009, 03:27
  4. Command in process does'nt work
    By mourad in forum Qt Programming
    Replies: 2
    Last Post: 2nd June 2009, 09:12
  5. How to communicate Qt Process with non-qt process
    By nrabara in forum Qt for Embedded and Mobile
    Replies: 9
    Last Post: 15th February 2009, 21:01

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.