[vbox-dev] Guest os display image from vbox python API?

Nikolay Igotti Nikolay.Igotti at Sun.COM
Sun Jun 28 10:20:33 GMT 2009


  Grigory,

It seems to be a problem with the way Python/MSCOM bridge treats 
multiple return arguments. As one can see from the .xidl file, method is 
described as following:
<method name="getFramebuffer">
<desc>
Queries the framebuffer for given screen.
</desc>
<param name="screenId" type="unsigned long" dir="in"/>
<param name="framebuffer" type="IFramebuffer" dir="out"/>
<param name="xOrigin" type="long" dir="out"/>
<param name="yOrigin" type="long" dir="out"/>
</method>

It takes one argument, and returns three. XPCOM bridge (used everywhere, 
but on Windows) handles this method signature naturally, by generating 
method that take one parameter and returns list. COM Python bridge (part 
of Python for Windows extensions, not of VirtualBox) gets confused, as 
expects 4 parameters, which really sounds wrong.

If you'll be able to recompile VirtualBox, then making framebuffer 
"return", not "out" parameter in xidl may help. Will try to sort out 
this issue once get back from vacations (~ 7 Jul).

Anyway, on Windows you may have other problems, as least have to invoke 
different external program to capture window content by its id.

Thanks,
Nikolay

Grigory Petrov пишет:
> It seems that my test on ubuntu was wrong: it works with some tinkering. It seems that getFramebuffer() method is completely different on ubuntu and windows. On windows, it takes 4 arguments and use 2-nd to return IFrameBuffer object. On Ubuntu, it takes 1 argument and return IFrameBuffer object. So, how to use it on windows?
>  
> On Thursday, June 25, 2009, at 08:12AM, "Grigory Petrov" <eyeofhell at me.com> wrote:
>   
>> In virtualbox API documentation it is listed that getFramebuffer()  
>> takes more than one parameter. I have tried your example code on both  
>> windows and ubuntu, beta1 and beta2. It's always 'invalid number of  
>> parameters' error. What is a trick to run a code you have suggested?
>>
>> Best, Grigory Petrov
>>
>> On Jun 23, 2009, at 2:21 PM, Nikolay Igotti <Nikolay.Igotti at Sun.COM>  
>> wrote:
>>
>>     
>>> Hi Grigory,
>>>
>>> Yes, it is possible, although in somewhat convoluted way, for  
>>> example on Linux in vboxshell one can issue following command  
>>> (assuming you started guest in not headless mode):
>>>
>>> vbox> guest nt4sp6 os.system('xwd -id '+str 
>>> (console.display.getFramebuffer(0)[0].winId)+'| xwdtopnm | pnmtopng  
>>>       
>>>> /tmp/Screenshot.png')
>>>>         
>>> It will take screen of the first display in guest called 'nt4sp6',  
>>> although relying upon few external programs
>>> for image conversion. Similar approach can be taken on Windows.
>>>
>>> We're considering implementing more straightforward API in the future.
>>>
>>> Thanks,
>>>   Nikolay
>>>
>>> Grigory Petrov wrote:
>>>       
>>>> Hello.
>>>>
>>>> Is it possible to use Python API in order to get image of guest os  
>>>> display? (complete display or part of display, with or without  
>>>> guest additions, it doesn't matter). I can speculate that this can  
>>>> be done somehow via getFramebuffer() method, but exact sequence is  
>>>> unclear - it's no example available :(.
>>>>
>>>> Best, Grigory
>>>>
>>>> _______________________________________________
>>>> vbox-dev mailing list
>>>> vbox-dev at virtualbox.org
>>>> http://vbox.innotek.de/mailman/listinfo/vbox-dev
>>>>
>>>>         
>>     
>
> _______________________________________________
> vbox-dev mailing list
> vbox-dev at virtualbox.org
> http://vbox.innotek.de/mailman/listinfo/vbox-dev
>   





More information about the vbox-dev mailing list