gpt4 book ai didi

java - SetWindowDisplayAffinity 失败并出现错误 "Access denied"

转载 作者:行者123 更新时间:2023-12-01 22:17:38 54 4
gpt4 key购买 nike

我正在使用java中的jna.extra.User32Extra库来查找窗口并更改windowdisplayaffinity值。但它返回“ACCESS DENIED”错误代码。

HWND top= target.findWindow("WindowTitle");
System.err.println(User32Extra.INSTANCE.SetWindowDisplayAffinity(top, 0));
System.err.println(Native.getLastError());

以下代码给出“false”和错误代码“5”(访问被拒绝)。

我需要任何额外的权限吗?该错误的原因是什么?

最佳答案

SetWindowDisplayAffinity 只能在调用进程拥有的窗口上使用。因此出现了错误。文档说:

This feature enables applications to protect their own onscreen window content from being captured or copied through a specific set of public operating system features and APIs.

如果另一个应用程序可以轻易地覆盖目标应用程序的选择,则该功能将变得无用。

关于java - SetWindowDisplayAffinity 失败并出现错误 "Access denied",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30682245/

54 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com