Results 1 to 2 of 2

Thread: Is it possible to prevent closure of the standard out terminal from killing our app?

  1. #1
    Join Date
    Jun 2008
    Location
    Boulder, Colorado, USA
    Posts
    70
    Thanks
    16
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Is it possible to prevent closure of the standard out terminal from killing our app?

    We have a large Qt 4.8.5 Windows desktop C++ / QWidget application which prints some information to standard out. That shows a terminal window. Unfortunately, clicking the Close-Window ("X") title-bar button on that terminal window ABORTS the entire application!

    We need to prevent that, EITHER BY preventing the terminal window closure -- OR at least by preventing the effect of that closure killing our application.

    Of course, in Qt, clicking that Close-Window ("X") button in a QWidget’s window can be ignored by intercepting and calling ignore() on the QCloseEvent. I don’t imagine that is relevant to the terminal window’s close-window button.

    Is there some Windows event handler (or something) we can define to consume that event? (or something) to prevent that window from closing, or at least prevent the application from exiting when that terminal window is closed?

    Or, as a last ditch can we force a message like "CLOSING THIS WINDOW WILL ABORT (THE APPLICATION) !!!" onto the standard-out terminal window's title bar? (But what we really want is the right solution).

    (We’re using Visual Studio 2010, mostly Windows 7).
    Thank you in advance. – Phil

  2. #2
    Join Date
    Apr 2010
    Posts
    2
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Is it possible to prevent closure of the standard out terminal from killing our a

    could you just get away with not having a console application? In other words, change the project file to remove console.
    Qt Code:
    1. CONFIG -= console
    2. CONFIG += windows
    To copy to clipboard, switch view to plain text mode 
    if you need the output, you could redirect with ios::rdbuf

  3. The following user says thank you to Wysodava for this useful post:

    philw (4th May 2014)

Similar Threads

  1. Replies: 3
    Last Post: 22nd August 2012, 10:19
  2. killing Qt timer.
    By jaxrpc in forum Newbie
    Replies: 5
    Last Post: 1st June 2010, 01:21
  3. SQL connection closure problem.
    By cbarmpar in forum Qt Programming
    Replies: 1
    Last Post: 8th September 2008, 09:42
  4. Replies: 2
    Last Post: 2nd June 2008, 09:45
  5. Killing a Window in its constructor
    By hardgeus in forum Qt Programming
    Replies: 6
    Last Post: 15th December 2006, 19:31

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.