Results 1 to 12 of 12

Thread: how to enable an app to be executed in GUI mode and console mode

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2007
    Posts
    166
    Thanks
    16
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to enable an app to be executed in GUI mode and console mode

    I don't think that the behavior you want is possible under Windows platform...

  2. #2
    Join Date
    Feb 2010
    Posts
    64
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to enable an app to be executed in GUI mode and console mode

    I want to print it in the console because an external software will made some checks about the version. So the real user will run the app just from the icon (without parameters, ) but the other checking software will run it with the versiona argument, in order to get the version and make some checks.

  3. #3
    Join Date
    Aug 2007
    Posts
    166
    Thanks
    16
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to enable an app to be executed in GUI mode and console mode

    Nice but not possible on Windows. Though you can always try with IPC, if you have the sources of the other software.

  4. The following user says thank you to The Storm for this useful post:

    locke (19th August 2010)

  5. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: how to enable an app to be executed in GUI mode and console mode

    Isn't it possible to set a version number for an exe just like you do for a DLL?

  6. #5
    Join Date
    Feb 2010
    Posts
    64
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to enable an app to be executed in GUI mode and console mode

    That sounds a bit complicate. Thanks anyways

  7. #6
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to enable an app to be executed in GUI mode and console mode

    You can use AllocConsole(). If your app already has a console it'll fail, otherwise it'll open a new console and set the appropriate handles for you (by default, GUI applications do not have a console)

    You can then use GetStdHandle(STD_OUTPUT_HANDLE) to get a handle to your console to which you can write to using WriteFile() or WriteConsole().

    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx
    http://msdn.microsoft.com/en-us/libr...=VS.85%29.aspx

  8. The following user says thank you to squidge for this useful post:

    locke (19th August 2010)

Similar Threads

  1. Replies: 1
    Last Post: 2nd November 2009, 12:02
  2. How to create single exe for Console & GUI mode
    By summer_of_69 in forum Qt Programming
    Replies: 4
    Last Post: 11th June 2009, 07:20
  3. Replies: 9
    Last Post: 15th April 2009, 06:23
  4. Replies: 8
    Last Post: 10th October 2007, 18:20
  5. Console in GUI Mode
    By plitex in forum Qt Programming
    Replies: 3
    Last Post: 22nd May 2007, 20:12

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.