The following code retrieves the IP address of a client from a collection of clients. The variable pClientsCollection points to an ISdoCollection interface for the collection. See Retrieving a Collection for information on how to retrieve the collection object.
HRESULT hr
_variant_t vtClientName = L"Test Client";
//
// Get the client "Test Client" from the collection of clients
//
CComPtr<IDispatch> pFoundClientDispatch;
hr = pClientsCollection->Item(&vtClientName, &pFoundClientDispatch);
if (FAILED(hr))
{
return hr;
}
CComPtr<ISdo> pFoundClientSdo;
hr = pFoundClientDispatch->QueryInterface(
__uuidof(ISdo),
(void **) &pFoundClientSdo
);
if (FAILED(hr))
{
return hr;
}
//
// Get the IP address of that client
//
_variant_t vtAddress;
hr = pFoundClientSdo->GetProperty(PROPERTY_CLIENT_ADDRESS ,&vtAddress);
if (FAILED(hr))
{
return hr;
}
Related topics
Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.
