주소 선택

다음 코드 예제에서는 TAPI 개체를 사용하여 지정된 미디어 형식 요구 사항 집합을 처리할 수 있는 주소에 대해 사용 가능한 전화 통신 리소스를 검사하는 방법을 보여 줍니다. 이 예제에서 오디오 및 비디오는 필수 미디어입니다.

이 코드 예제를 사용하기 전에 TAPI 초기화에서 작업을 수행해야 합니다.

참고

이 예제에는 오류 검사 및 프로덕션 코드에 적합한 릴리스가 없습니다.

// Declare the interfaces used to select an address.
IEnumAddress * pIEnumAddress;
ITAddress * pAddress;
ITMediaSupport * pMediaSupport;

// Use the TAPI object to enumerate available addresses.
hr = gpTapi->EnumerateAddresses( &pIEnumAddress );
// If (hr != S_OK) process the error here. 

// Locate an address that can support the media type the application needs.
while ( S_OK == pIEnumAddress->Next(1, &pAddress, NULL) )
{
    // Determine the media support.
    hr = pAddress->QueryInterface(
         IID_ITMediaSupport,
         (void **)&pMediaSupport
         );
    // If (hr != S_OK) process the error here. 

    // In this example, the required media type is already known.
    // The application can also use the address object to
    // enumerate the media supported, then choose from there.
    hr = pMediaSupport->QueryMediaType(
         TAPIMEDIATYPE_AUDIO|TAPIMEDIATYPE_VIDEO,
         &bSupport
         );
    // If (hr != S_OK) process the error here. 

    if (bSupport)
    {
        break;
    }
}
// pAddress is now a usable address.

ITTAPI::EnumerateAddresses

ITMediaSupport

TAPIMEDIATYPE_ 상수