win32api.GetAsyncKeyState为什么不是全局热键?

huangapple go评论133阅读模式
英文:

Why is win32api.GetAsyncKeyState not a global hotkey?

问题

我正在尝试制作一个可以自动将鼠标移动到特定位置的机器人唯一的问题是现在该函数不再是全局的但原因不明
英文:

I'm trying to make a bot that automatically moves the mouse to a specific location. Only problem now is that the function was global, but now isn't anymore for some reason.

import mouse  
import configparser   
import win32api


hexstring = config.get("keypress", "keypress")
an_int = int(hexstring, 16) 

if win32api.GetAsyncKeyState(an_int)  < 0:
   mouse._os_mouse.move_relative(int(xcoord), int(ycoord))

答案1

得分: -1

我找到了错误。我只需要以管理员身份打开该应用程序。

英文:

I found the error. I just needed to open the application as an administrator.

huangapple
  • 本文由 发表于 2023年7月20日 20:14:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76729744.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定