Hide C ++ console program from taskbar

I have a small console console that calls another console application. Something like Winamp has a lot of windows (main and playlist). The fact is that when I call two, for example, console windows, the programs open in the taskbar get too much, I do not need to open the windows separately, I only want main to stay on the taskbar, and when I click on it , she and all his child applications appear.

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

+5
source share
2 answers

, , - 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();
}
+5

Obvlious , :

ITaskbarList *pTaskList = NULL;
HRESULT initRet = CoInitialize(NULL);
HRESULT createRet = CoCreateInstance( CLSID_TaskbarList,
                                      NULL,
                                      CLSCTX_INPROC_SERVER,
                                      IID_ITaskbarList,
                                      (LPVOID*)&pTaskList );

if(createRet == S_OK)
{

    pTaskList->DeleteTab(GetConsoleWindow());

    pTaskList->Release();
}

CoUninitialize();

ShObjIdl.h !

. S_OK initRet createRet!

+7

All Articles