如何在 Windows 10 上的任务栏按钮中显示进度? [英] How to show progress in taskbar button on Windows 10?

查看:60
本文介绍了如何在 Windows 10 上的任务栏按钮中显示进度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Windows 10 上的任务栏按钮上显示进度,但是我在网上找到的两种方法都不起作用.以下示例失败并显示错误 OSError: [WinError -2147312566] Error when loading Typelib/DLL:

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)

并且以下示例失败并显示错误 TypeError: 没有注册的接口对象支持此 IID:

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)

我做错了什么?

推荐答案

我找到了解决方案.我必须下载 Taskbarlib.tlb.那么第一个例子就起作用了.

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

这篇关于如何在 Windows 10 上的任务栏按钮中显示进度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆