[vbox-dev] Regarding about the LaunchVMProcess in c++ code
John Lee
skjl25 at gmail.com
Wed Feb 9 21:16:52 PST 2011
Hello,
I'm trying to employ the usage of the LaunchVMProcess() in c++ for the
virtual box.
//here is the sample code
nsCOMPtr<ISession> session;
{
nsCOMPtr<nsIComponentManager> manager;
rc = NS_GetComponentManager (getter_AddRefs (manager));
if (NS_FAILED(rc))
{
printf("Error: could not get component manager! rc=%08X\n",
rc);
return;
}
rc = manager->CreateInstanceByContractID (NS_SESSION_CONTRACTID,
nsnull,
NS_GET_IID(ISession),
getter_AddRefs(session));
if (NS_FAILED(rc))
{
printf("Error, could not instantiate session object!
rc=0x%x\n", rc);
return;
}
rc = machine->LockMachine(session, LockType_Write);
if (NS_FAILED(rc))
{
printf("Error, could not lock the machine for the session!
rc=0x%x\n", rc);
return;
}
rc = session->GetMachine(getter_AddRefs(machine));
if (NS_FAILED(rc))
{
printf("Error, could not get machine session! rc=0x%x\n", rc);
return;
}
rc=machine->LaunchVMProcess(session,sessionType,env,&progress);
}
nsCOMPtr<IMachine> machine;
The problem formulates at the LaunchVMProcess();
Somehow the VM does not instantiate.
So another method that I have tried to use was declare the machine as
"IMachine machine;"
Somehow with this methodology, I got the error message that it cannot
declare variable 'machine' to be a abstract type 'IMachine.'
I'm not sure how to fix this problem. Is there a way to fix the problem?
For further information, I have used the VirtualBox 4.0 SDK and the
sample code tstVBoxAPILinux.cpp.
Thank you in advance.
Sincerely,
Suk Kyu Lee
More information about the vbox-dev
mailing list