[This is preliminary documentation and subject to change.]
The following code fragment demonstrates creating the TAPI object, checking its addresses, and examining an address's media capabilities.
// Create TAPI entry point object
CoCreateInstance(CLSID_TAPI,
NULL,
CLSCTX_INPROC_SERVER,
IID_ITTAPI,
(void **) &pTAPI);
// Initialize
pTAPI->Initialize;
// Enumerate addresses
pTAPI->_EnumerateAddresses(&pIEnumAddresses);
// Go through addresses
while ( S_OK == pEnumAddresses->Next(1,
&pAddress,
NULL)))
{
// determine the media support
pAddress->QueryInterface(IID_ITMediaSupport
&pMediaSupport);
// in this fragment, the media desired is already known.
// the application can also use the address object to
// enumerate the media supported, then choose from there.
pMediaSupport->QueryMediaType(bstrMediaTypeImInterestedIn,
&bSupport);
if (bSupport)
{
break;
}
}
// pAddress is now an address I can use.
// determine the terminal support
hr = pAddress->QueryInterface(IID_ITTerminalSupport,
&pTerminalSupport);
// just use the default terminal
pTerminalSupport->GetDefaultTerminal(pMediaTypeImInterestedIn,
&pTerminal);
if (!SUCCEEDED(hr))
{
//failure
}
// now we have a terminal, and we already knew the media, so
// make the call