Now the name of each server and the description of each adapter must be retrieved.
This code performs the following steps to loop through all the servers in the array and then find all the adapters on each server. The descriptions of the adapters are stored, as shown. The description of each adapter stored in this list will be displayed in the menu.
int Servnum = spiServers->Count; int index,index2,LineNumber=0; VARIANT ItemNum;
/* Loop on all the servers */ for (index=1;index<=Servnum;index++) { ItemNum.vt = VT_I4; ItemNum.lVal = index; FPCLib::IFPCServerPtr spiServer(spiServers->Item(ItemNum)); _bstr_t name = spiServer->Name; FPCLib::IFPCAdaptersPtr spiAdapterList(spiServer->Adapters); int AdapNum = spiAdapterList->Count; /* Make a node for this server */ ServItem = m_ListTree.InsertItem( name, 0, 0,RootItem); /* Loop on all the adapters */ for (index2=1;index2<=AdapNum;index2++) { FPCLib::IFPCAdapterPtr spiAdapter(spiAdapterList->Item(index2)); _bstr_t Desc = spiAdapter->Description; /* Make a line for every adapter */ m_ListTree.InsertItem( Desc, 0, 0,ServItem); m_ListCtl.InsertItem( (LineNumber), _T("")); m_ListCtl.SetItemText((LineNumber),0, name ); m_ListCtl.SetItemText((LineNumber),1, Desc); LineNumber++; } }
Send comments about this topic to Microsoft
Build date: 11/30/2009
© 2008 Microsoft Corporation. All rights reserved.