Click here to Skip to main content
15,890,670 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi,

I have created a Oracle Virtual Box Virtual Machine and was able to successfully boot it automatically using Virutal Box sdk using C++. I wish to attach a Network adapter and connect it to a Bridged Network during the automated create process. I am not able to find any working example of attaching network adapter to VM using the virtual box sdk (c++). Any help regarding the same would be appreciated.

Thanks in advance
Posted
Updated 20-Aug-12 5:39am
v2

1 solution

Finally, i found it for my self:
C#
INetworkAdapter *adpt = NULL;
    rc = iMachine->GetNetworkAdapter(0, &adpt);
    rc = adpt->put_Enabled(TRUE);
    rc = adpt->put_AttachmentType(NetworkAttachmentType_HostOnly);
    rc = iMachine->SaveSettings();

This adds Host_only Network Adapter to the Guest Machine in Virtual Box.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900