Hello.
I'm using VirtualBox to automate old DOS program and need to takes screenshots
of guest OS in order to manipulate a program correctly. I have tried the
following test code:
void main( void )
{
::CoInitialize( 0 );
IVirtualBox* poVbox = 0;
::CoCreateInstance( CLSID_VirtualBox, 0, CLSCTX_ALL, IID_IVirtualBox,
(void**)& poVbox );
SAFEARRAY* poVmList = 0;
poVbox->get_Machines( & poVmList );
IMachine** ppoVmArray = 0;
::SafeArrayAccessData( poVmList, (void**)& ppoVmArray );
BSTR oVmId;
(* ppoVmArray)->get_Id( & oVmId );
ISession* poSession = 0;
HRESULT hRet = ::CoCreateInstance( CLSID_Session, 0, CLSCTX_ALL,
IID_ISession, (void**)& poSession );
IProgress* poProgress = 0;
BSTR oEnvir = ::SysAllocString( L"" );
hRet = poVbox->OpenRemoteSession( poSession, oVmId, ::SysAllocString( L"gui"
), oEnvir, & poProgress );
// Wait resonable time for VM to start and to display something.
::Sleep( 10000 );
IConsole* poConsole = 0;
hRet = poSession->get_Console( & poConsole );
IDisplay* poDisplay = 0;
hRet = poConsole->get_Display( & poDisplay );
UINT32 anMem[ 100 ] = { 0 };
hRet = poDisplay->TakeScreenShot( (BYTE*)anMem, 10, 10 );
assert( SUCCEEDED( hRet ) );
}
All works, VirtualBox starts and loads guest OS, but after calling
TakeScreenShow() it returns E_NOTIMPL :(. Does anyone know what can i do? Maybe
i need to use other API functions, get screen buffer, register for updates
notifications or something? Host OS is windows XP SP3, latest VirtualBox and
SDK from site. I will be very glad if someone can share an working example on
how to take an screenshot / image of guest OS desktop, that will help a lot! Or
maybe it's some error in my code?
Best, Grigory
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev