1

I'm trying to show the progress on the taskbar button on Windows 10, but both methods I've found on the Web do not work. The following example fails with the error OSError: [WinError -2147312566] Error when loading Typelib/DLL:

CLSID_TaskbarList = "{56FDF344-FD6D-11d0-958A-006097C9A090}"
IID_ITaskbarList3 = "{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}"

import comtypes.client as cc

cc.GetModule("TaskbarLib.tlb")

import comtypes.gen.TaskbarLib as tbl
taskbar = cc.CreateObject(CLSID_TaskbarList, interface=tbl.ITaskbarList3)

and the following example fails with the error TypeError: There is no interface object registered that supports this IID:

import pythoncom

CLSID_TaskbarList = "{56FDF344-FD6D-11d0-958A-006097C9A090}"
IID_ITaskbarList3 = "{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}"

taskbar = pythoncom.CoCreateInstance(CLSID_TaskbarList, None, pythoncom.CLSCTX_ALL, IID_ITaskbarList3)
print(taskbar)

What am I doing wrong?

Martin Bammer
  • 537
  • 7
  • 19
  • Perhaps the condition of only desktop applications may be affecting something. [ITaskbarList3 interface](https://learn.microsoft.com/en-us/windows/win32/api/shobjidl_core/nn-shobjidl_core-itaskbarlist3) `Minimum supported client Windows 7 [desktop apps only]` – kunif May 11 '20 at 05:06
  • I've already tried it with a tkinter app. Same problem. – Martin Bammer May 11 '20 at 07:45
  • It's C#, not Python, but this article may be helpful. [Windows 7 progress bar in taskbar in C#?](https://stackoverflow.com/q/1295890/9014308) – kunif May 11 '20 at 08:04

1 Answers1

0

I've found a solution. I had to download Taskbarlib.tlb. Then the first example works.

Martin Bammer
  • 537
  • 7
  • 19
  • Perhaps these are related articles. [Using Windows 7 taskbar features in PyQt](https://stackoverflow.com/q/1736394/9014308), [Python + Tkinter Windows 7 taskbar progress](https://stackoverflow.com/q/17607415/9014308) – kunif May 12 '20 at 01:55