Results 1 to 20 of 33

Thread: Both a command line and GUI application at the same time?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Both a command line and GUI application at the same time?

    All mixed console/GUI Windows apps I have seen for a long time were exe files. And what's wrong in wrapping ReadConsole/WriteConsole and stdin/stdout into one clean interface and using that? It's probably around 10-20 lines of code total.
    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.


  2. #2
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Both a command line and GUI application at the same time?

    Quote Originally Posted by wysota View Post
    All mixed console/GUI Windows apps I have seen for a long time were exe files. And what's wrong in wrapping ReadConsole/WriteConsole and stdin/stdout into one clean interface and using that? It's probably around 10-20 lines of code total.
    Would any of those console/GUI Windows applications be freely available for download, so that I can try them out? I would certainly interested to see how they behave and, therefore, see whether they have any of the pitfalls that I have read about and experienced myself.

    As for ReadConsole/WriteConsole, did you read the quote I just gave and my comment #13? In my experience (and that of the article author, if one is to believe what he wrote) is that it's messy. Now, I am certainly not claiming that my use of AttachConsole and WriteConsole was perfect. In other words, I am not excluding the fact that I may have done something sub-optimal, if not wrong, but in that case I would then very much appreciate some pointers to what you would consider to be the 'perfect' use of those Windows API functions.

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

    Default Re: Both a command line and GUI application at the same time?

    Quote Originally Posted by agarny View Post
    Would any of those console/GUI Windows applications be freely available for download, so that I can try them out? I would certainly interested to see how they behave and, therefore, see whether they have any of the pitfalls that I have read about and experienced myself.
    I don't know, I guess some tools Microsoft provides with Windows fall into this category but to be honest, I'm not sure.

    Anyway I still fail to see what's wrong with attaching a console. Redirection works in terms of stdin/stdout and not console so it might work. At worst you can find a way to open stdout but it is so Windows specific that you have to look for help at more suited sites than ours.
    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.


  4. #4
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Both a command line and GUI application at the same time?

    Quote Originally Posted by wysota View Post
    Anyway I still fail to see what's wrong with attaching a console.
    As I said, I may be wrong and maybe attaching a console could work. It's just that I haven't been able to get things to work to my satisfaction (again, see comment #13), and what I have found on the Internet so far seems to indicate that it might not be possible indeed. I shall certainly keep looking for it when I have time, since I would rather just have one .exe file than both a .com and a .exe file.
    Quote Originally Posted by wysota View Post
    Redirection works in terms of stdin/stdout and not console so it might work.
    I am not sure what you mean by this.
    Quote Originally Posted by wysota View Post
    At worst you can find a way to open stdout but it is so Windows specific that you have to look for help at more suited sites than ours.
    That, I can only agree with indeed!

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

    Default Re: Both a command line and GUI application at the same time?

    Quote Originally Posted by agarny View Post
    I am not sure what you mean by this.
    By redirection I mean the redirection operator (">") which associates stdout of a process with a file. Console has nothing to do with this really.
    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.


  6. #6
    Join Date
    Mar 2010
    Posts
    319
    Thanks
    1
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Both a command line and GUI application at the same time?

    Oh, ok, got you, and yes indeed.

Similar Threads

  1. Replies: 1
    Last Post: 7th September 2010, 15:49
  2. Replies: 3
    Last Post: 23rd February 2010, 04:33
  3. QProcess and the command line
    By auba in forum Qt Programming
    Replies: 17
    Last Post: 27th May 2009, 10:39
  4. Replies: 0
    Last Post: 28th February 2009, 23:18
  5. Retrieving command line arguments inside a Qt application
    By prykHetQuo in forum Qt Programming
    Replies: 5
    Last Post: 14th February 2009, 14:28

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
  •  
Qt is a trademark of The Qt Company.