ITMediaSupport::QueryMediaType的问题:
程序大意如下,前面COM初始化的略去了。基本上都是从MSDN中copy过来的。 IEnumAddress* pIEnumAddresses;
ITAddress  *pAddress;
ITMediaSupport *pMediaSupport;
VARIANT_BOOL bSupport;
hr = gpTapi->_EnumerateAddresses( &pIEnumAddresses );
if( FAILED(hr) )
MessageBox("enumerate addresses failed!"); // Locate an address that can support the 
// media type the application needs.
ULONG lg;
while ( S_OK == pIEnumAddresses->Next(1, &pAddress, &lg) ) 
{
// Determine the media support.
hr = pAddress->QueryInterface(
IID_ITMediaSupport,
(void **)&pMediaSupport
);
if( FAILED(hr) )
MessageBox("get mediasupport failed");
// In this snippet, the required media type is already known.
// The application can also use the address object to
// enumerate the media supported, then choose from there.
pMediaSupport->QueryMediaType(
TAPIMEDIATYPE_String_AudioIn ,
&bSupport
);
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~词语句又问题!! if (bSupport)
{
break;
}
pAddress->Release();
pMediaSupport->Release();
}上面画横下的语句:pMediaSupport->QueryMediaType 在循环中可以执行2-3次,但再往后就会提示 0xc000005 , Access violation。
不明白是怎么回事,还有QueryMediaType 的第一个参数TAPI3.h中定义为:BSTR,而MSDN中定义为LONG,是二者版本不一致造成的吗?