简体   繁体   中英

How to show progress in taskbar button on Windows 10?

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM