Question

I am in a need of hiding the console window, which I quickly resolved by P/Invoking ShowWindow. However, the call hides the console window as well as the taskbar button of the console window. I need the taskbar button to remain visible. I am not, however, looking for a way to minimize the console window. Clicking the taskbar button show not do anything. I tried to use SetWinEventHook and hide the window every time it was activated, but to no avail, as the window calling this function must run message loop in order to receive the events (and my console window didn't, no matter if I set OutOfContext or InContext flag).

Is there a way I can make my console application run, show itself in taskbar, then hide itself (or never show itself in a first place) and just keep running with no window but taskbar button visible?

Était-ce utile?

La solution

The normal way to get a button on the taskbar is to create a visible unowned top-level window. So that's no use to you. One possible alternative is to use ITaskbarList::AddTab to add a button. I don't know whether or not this will do anything for an invisible window. Either way you'd need to run a message loop for your window. Even if you could do this the net result would not feel very nice for the user.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top