简体   繁体   English

如何在 Windows 10 上的任务栏按钮中显示进度?

[英]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.我试图在 Windows 10 上的任务栏按钮上显示进度,但是我在 Web 上找到的两种方法都不起作用。 The following example fails with the error OSError: [WinError -2147312566] Error when loading Typelib/DLL :以下示例失败并出现错误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 :以下示例失败并显示错误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.我不得不下载Taskbarlib.tlb。 Then the first example works.然后第一个示例有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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