【问题标题】:How to detect which windows desktop I'm on in python3?如何检测我在 python3 中使用的 Windows 桌面?
【发布时间】:2020-12-30 22:01:37
【问题描述】:

在 Windows 10 中,您可以创建多个桌面并在它们之间切换。 我想在某个桌面上运行 python3 代码。 如何检测我在哪个桌面上?

【问题讨论】:

  • @ΕυάγγελοςΓρηγορόπουλος,这如何帮助 OP 解决他们关于当前Windows desktop 的问题?
  • 我不在 Windows 上,但请参阅此答案 here 和链接的 VirtualDesktopAccessor.dll。那么它可能是 GetCurrentDesktopNumber() 您需要从该库中调用的内容。

标签: python python-3.x windows windows-10 desktop


【解决方案1】:

here 下载 VirtualDesktopAccessor.dll 并将其放在您的工作目录中。

运行以下代码:

import ctypes

vda = ctypes.WinDLL("VirtualDesktopAccessor.dll")
num = vda.GetCurrentDesktopNumber()
print(num)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多