Microsoft Internet Security and Acceleration Server 2000

Listing the Adapters

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.

  1. Find the number of servers in the array. Here the number of servers is being retrieved by using the Count property of the FPCServer administration COM object.
    	int Servnum = spiServers->Count;
    	int index,index2,LineNumber=0;
    	VARIANT ItemNum;
    
    
  2. Loop through all servers in the array, and find all adapters on each server. Here is where the code uses the administration objects Adapters and FPCServer to retrieve information about the adapters.
    	/* 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++;
     
    	}
     
    }