Microsoft Internet Security and Acceleration Server 2000 |
Now that each server has been retrieved, the names of each adapter must be retrieved. This code is taken from the file AdapterList.cpp, included in the serversconfigsample directory.
The code will loop through all the servers in the array, then find all adapters on each server. The names of each are stored, as shown. 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++; } }