从主机外壳向VirtualBox VM发送鼠标或触摸事件? [英] Sending mouse or touch events to VirtualBox VM from host shell?
本文介绍了从主机外壳向VirtualBox VM发送鼠标或触摸事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道如何使用VBoxManage controlvm keyboardputscancode <scancode> <scancode> <etc...>
是否有类似的方式来模拟鼠标或触摸事件?例如,将鼠标移动到某个坐标或一定距离,或者发送鼠标单击,或者在给定坐标上发送触摸/点击?
Is there a similar way to simulate mouse or touch events? For example, move the mouse to a certain coordinate or over a certain distance, or send a mouse click, or send a touch/tap on a given coordinate?
推荐答案
您可以使用Python做到这一点
You can do this using Python
from vboxapi import VirtualBoxManager
mgr = VirtualBoxManager(None, None)
vbox = mgr.getVirtualBox()
machine = vbox.findMachine('CentOS')
session = mgr.getSessionObject(vbox)
machine.LockMachine(session, mgr.constants.LockType_Shared)
session.Console.Mouse.putMouseEventAbsolute(100,100,0,0,1)
有关更多信息,请在此处
这篇关于从主机外壳向VirtualBox VM发送鼠标或触摸事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文