Discussion:
[vbox-dev] help me:ISession->get_Console return null
iamhatling
2014-06-12 09:22:33 UTC
Permalink
sorry for my bad english

i want to write a vbox frontend,
but i met a problem at the beginning,

when i call "ISession->get_Console " to get the console interface ,it return null,
the following is my code


+++++++++++++++++++++++++++++++++++++++++++++++++
IVirtualBox *virtualBox;
IVirtualBoxClient* virtualBoxClient;

CoInitialize(NULL);
CoCreateInstance(
CLSID_VirtualBoxClient,
NULL,
CLSCTX_INPROC_SERVER,
IID_IVirtualBoxClient,
(void**)&virtualBoxClient
);

ISession* session;
virtualBoxClient->get_Session(&session);
virtualBoxClient->get_VirtualBox(&virtualBox);

IMachine* machineTemp;
BSTR machineName = SysAllocString(L"xp");
virtualBox->FindMachine(machineName,&machineTemp);
SysFreeString(machineName);

machineTemp->LockMachine(session,LockType_VM);

IMachine* machine;
session->get_Machine(&machine);

IConsole* console;
session->get_Console(&console);////////////console=null here
+++++++++++++++++++++++++++++++++++++++





iamhatling
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.virtualbox.org/pipermail/vbox-dev/attachments/20140612/355983a5/attachment.html
Klaus Espenlaub
2014-06-16 10:50:01 UTC
Permalink
Hi,
Post by iamhatling
sorry for my bad english
i want to write a vbox frontend,
but i met a problem at the beginning,
when i call "ISession->get_Console " to get the console interface ,it return null,
the following is my code
Hard to tell what's going wrong, as you're not checking any result code.

Your code looks superficially OK, no idea what exactly is failing. Must
be something related to the session/locking...

Klaus

Loading...