i know get the windows taskbar HWND:

HWND GetDesktopToolBar()
{
    return FindWindow("Shell_Traywnd", "");
}

now i can do:
1 - add controls on left side(close to Start Button)... but the click messages isn't working. maybe because use the form messages procedure. can anyone correct me?;
2 - enable\visible it.

but, for exemple, the windows media player minitoolbar is added to Tray Notifiction left side. how can i add it?
i know the minitoolbar it's an DLL. but how can i add it to taskbar?

Recommended Answers

All 9 Replies

const GUID CLSID_TaskbarList = {0x56FDF344, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90}};
const GUID IID_ITaskbarList = {0x56FDF342, 0xFD6D, 0x11D0, {0x95, 0x8A, 0x00, 0x60, 0x97, 0xC9, 0xA0, 0x90}};
const GUID IID_ITaskbarList2 = {0x602D4995, 0xB13A, 0x429b, {0xA6, 0x6E, 0x19, 0x35, 0xE4, 0x4F, 0x43, 0x17}};
const GUID IID_ITaskList3 = {0xEA1AFB91, 0x9E28, 0x4B86, {0x90, 0xE9, 0x9E, 0x9F, 0x8A, 0x5E, 0xEF, 0xAF}};


void AddToTaskBar(HWND WindowHandle)
{
    ITaskbarList* TaskListPtr;
    CoInitialize(nullptr);
    long Result = !CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_SERVER, IID_ITaskbarList, reinterpret_cast<void**>(&TaskListPtr));
    if (Result) TaskListPtr->AddTab(WindowHandle);
    TaskListPtr->Release();
    CoUninitialize();
}

void RemoveFromTaskBar(HWND WindowHandle)
{
    ITaskbarList* TaskListPtr;
    CoInitialize(nullptr);
    long Result = !CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_SERVER, IID_ITaskbarList, reinterpret_cast<void**>(&TaskListPtr));
    if (Result) TaskListPtr->DeleteTab(WindowHandle);
    TaskListPtr->Release();
    CoUninitialize();
}

i'm sorry, but what is the library for use the ITaskbarList and others?

i must include the Shobjidl.h but i need include anotherthing for the linker too:
"undefined reference to `_imp__CoCreateInstance@20'"
i have several errors like these. but i can't find the right lib, can you help me?

AFAIK, you'll need to include objbase.h and link ole32.lib.

using that code, i can add a child control,too, on task bar but will be above the icon\button where is the program :(
can i add 1 button after the others?

I don't understand what you mean by that statement.. The above code is what is used to add tabs to the taskbar and remove tabs from the taskbar.

Not sure what you mean by add 1 button after the other..

i mean add a button on taskbar for do some action

There was one project on CodeProject...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.