This is how the Qt GUI populates the list:

QStringList VBoxVMSettingsNetworkPage::intList (bool aRefresh)
593     {
594         if (aRefresh)
595         {
596             /* Load total network list of all VMs */
597             mIntList.clear();
598             CVirtualBox vbox = vboxGlobal().virtualBox();
599             ulong count = qMin ((ULONG) 4, 
vbox.GetSystemProperties().GetNetworkAdapterCount());
600             CMachineVector vec = vbox.GetMachines();
601             for (CMachineVector::ConstIterator m = vec.begin(); m != 
vec.end(); ++ m)
602             {
603                 if (m->GetAccessible())
604                 {
605                     for (ulong slot = 0; slot < count; ++ slot)
606                     {
607                         QString name = m->GetNetworkAdapter 
(slot).GetInternalNetwork();
608                         if (!name.isEmpty() && !mIntList.contains (name))
609                             mIntList << name;
610                     }
611                 }
612             }
613         }
614     
615         /* Append network list with names from all the pages */
616         QStringList list (mIntList);
617         for (int index = 0; index < mTwAdapters->count(); ++ index)
618         {
619             VBoxVMSettingsNetwork *page =
620                 qobject_cast <VBoxVMSettingsNetwork*> (mTwAdapters->widget 
(index));
621             if (page)
622             {
623                 QString name = page->alternativeName 
(KNetworkAttachmentType_Internal);
624                 if (!name.isEmpty() && !list.contains (name))
625                     list << name;
626             }
627         }
628     
629         return list;
630     }


On Jan 16, 2010, at 17:11 , Thomas Trepper wrote:

> Hi all,
> 
> while trying to get the IMachine-attached network adapters I wonder if there 
> is a way to get the amount of attached or available slots?
> I can try
> 
> INetworkAdapter tmp = vBoxFromHost.getNetworkAdapter(0L);
> 
> but I have not idea, how many slots can exit on various machines. Is there a 
> way to obtain the maximum for iteration?
> 
> Thanks a lot and best regards,
> 
> Thomas
> 
> 
> 
> 
> _______________________________________________
> vbox-dev mailing list
> [email protected]
> http://vbox.innotek.de/mailman/listinfo/vbox-dev


_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev

Reply via email to