VBoxManage.exe
is an Oracle VirtualBox companion utility, which allows to control VMs via command line. It can do numerous operations, including start/stop and screen capturing.
I am interested, which API it uses?
How can I capture VM screen or send keyboard or mouse commands there without this heavy commandline utility? Which language is better? Is is possible to access this API with Java?
One of the advantages to using an open source project is supposed to be that you can answer such questions by looking at the source.
VBoxManage is located in the source repository under /src/VBox/Frontends/VBoxManage. The code you're looking for is in
VBoxManageControlVM.cpp
under the conditionif (!strcmp(a->argv[1], "screenshotpng"))
:So it's done via a COM API, and you can look at:
Is it possible to call a COM API from Java?
Googling for
TakeScreenShotPNGToArray
finds the display interface:https://www.virtualbox.org/sdkref/interface_i_display.html
From there you can find the list of all the other things like mouse and keyboard:
https://www.virtualbox.org/sdkref/annotated.html