- Showing the progress of an operation in the taskbar
- Showing an overlay icon over the taskbar item
- Add a tooltip to the taskbar thumbnai
- Adding a toolbar to the taskbar of the application
- Include Shobjidl.h
- Initialize the COM library by calling CoInitialize() or CoInitializeEx()
- After your main window is created (e.g. after CreateWindowEx() call), define the message "TaskbarButtonCreated" using RegisterWindowMessage():
UINT taskbarButtonCreatedMessageId = RegisterWindowMessage ( "TaskbarButtonCreated" );
Store the returned message ID for later use. - To ensure that your main window receives this message, enhance the message reception filter privileges:
ChangeWindowMessageFilterEx(mainWindow, taskbarButtonCreatedMessageId, MSGFLT_ALLOW, NULL); - Afterwards the message with ID returned by RegisterWindowMessage() is sent to the window procedure of your main window. If it's received, create an instance of the ITaskbarList3 interface using CoCreateInstance():
ITaskbarList3* pTaskbar = NULL;
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == taskbarButtonCreatedMessageId)
{
HRESULT hr = CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList3, reinterpret_cast(&pTaskbar));
}
...
} - From now on, you can call the ITaskbarList3 functions using variable pTaskbar, e.g. pTaskbar->SetProgressState(hwnd, TBPF_ERROR);
- Before quitting the application, remember to release the interface and close the COM library:
pTaskbar->Release();
CoUninitialize();
ITaskbarList3 interface at MSDN: https://msdn.microsoft.com/en-us/library/windows/desktop/dd391692(v=vs.85).aspx
Regards, Sunshine2k