从任务栏隐藏控制台C

从任务栏隐藏控制台C

本文介绍了从任务栏隐藏控制台C ++程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些控制台游戏,呼叫另一个控制台应用程式。像 Winamp 的许多窗口(播放列表)。事情是当我调用两个例如控制台窗口在任务栏中打开的程序太多,我不需要单独打开窗口,我只想要窗口停留在任务栏中,当我点击它时,会弹出 所有子应用。

I have a little console game that calls another console app. Something like Winamp's many windows (main and playlist). The thing is when I call two for example console windows the programs opened in the taskbar get too many, I don't need to open the windows separately, I want only the main window to stay in the taskbar and when I click on it, it and all its child apps to pop up.

PS我熟悉 ShowWindow(GetConsoleWindow(),SW_HIDE); ,但它隐藏窗口,我希望它只能从任务栏中隐藏。

P.S. I am familiar with ShowWindow ( GetConsoleWindow(), SW_HIDE );, but it hides the window as well and I want it to be hidden only from the taskbar.

推荐答案

我知道要在控制台窗口上完成此操作的唯一方法是使用shell接口。

The only way I am aware of to accomplish this on a console window is to use the shell interface ITaskbarList.

hr = CoCreateInstance(
    CLSID_TaskbarList,
    NULL,
    CLSCTX_INPROC_SERVER,
    IID_ITaskbarList,
    reinterpret_cast<void**>(&taskbar));
if(!FAILED(hr))
{
    // Remove the icon from the task bar
    taskbar->DeleteTab(GetConsoleWindow());
    // Release it
    taskbar->Release();
}

这篇关于从任务栏隐藏控制台C ++程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 09:32