Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved] Show / hide console window
Forum Updated to NodeBB v4.3 + New Features

[Solved] Show / hide console window

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 2.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    moravas
    wrote on 11 Jan 2016, 12:01 last edited by moravas 1 Dec 2016, 07:06
    #1

    Hi Folks,

    I'm googling since a day, but my issue seems to be opened already. I have a console application on Windows 7, that I have to push down to the Windows Tray (collection of icons at the right - bottom side) when the user clicks on the "hide" control of the console window. I discovered, that I have to add "widgets" library to my project (I started from console application) and I can use QSystemTrayIcon for this purposes.
    The question is: how can hide the console window itself and show it again if the user click on the icon on the system tray?
    I didn't have to found such a solution (show() and hide() slots) as I can use on QMainwindow instance. And I would like to avoid winAPI calls. I prefer the clean Qt solutions:)

    Can anybody help me?

    Regards,
    Norbert

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on 11 Jan 2016, 12:57 last edited by
      #2

      A popular misconception is that the console window is part of your app. It is not. When you create a console app your app has no window. All it does is read/write to/from the standard input/output. The window you see is provided by OS and is a separate entity. So it's not a widget and as such, can't be controlled by Qt.

      So your options include:

      • Use WinAPI to find the window that hosts your app and ask it to minimize, show etc. via Windows messages.
      • Switch to ui application and emulate a console as a widget
      • Switch to ui application with no widget and spawn your own console instance. Talking to it requires WinAPI calls.
      1 Reply Last reply
      0

      1/2

      11 Jan 2016, 12:01

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved