1

我正在尝试使用 Python 2.6 中的 pywinauto 在 Windows 8.1 中枚举和自动化 Metro 风格的应用程序。如果我使用 Windows Kit 中的 inspect.exe 来获取 HWND,然后将其传递给 pywinauto.handleprops.process_id(),我就能获得正确的进程 ID。

但是,如果我使用 pywinauto.findwindows.enum_windows(),我看不到那里列出了 inspect.exe 的特定 HWND。我怀疑原因可能与 UAC/UIPI 有关,因为 c:\python26\python.exe 没有清单。我对么?

我尝试通过放置下面的 python.exe.manifest 和 pythonw.exe.manifest 来解决:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright (c) Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity
    name="*.*.*"
    processorArchitecture="x86"
    version="1.0.0.0"
    type="win32"/>
  <description>*</description>
  <dependency>
      <dependentAssembly>
          <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="*"
            publicKeyToken="6595b64144ccf1df"
            language="*"/>
    </dependentAssembly>
  </dependency>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
      <security>
          <requestedPrivileges>
              <requestedExecutionLevel level="highestAvailable" uiAccess="true"/>
          </requestedPrivileges>
      </security>
  </trustInfo>
</assembly>

但这似乎没有帮助。我什至不认为 UAC 提升会发生,因为没有出现 UAC 提示。无论如何,inspect.exe.manifest on uses<requestedExecutionLevel level="asInvoker" uiAccess="true"/>

有没有人有更好的建议我应该怎么做?

4

0 回答 0