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,是二者版本不一致造成的吗?
程序大意如下,前面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,是二者版本不一致造成的吗?
解决方案 »
- 生成Release版本时遇到的问题
- 我的关于进程与函数的理解
- 如何看这是什么消息,在MSDN里找到它?
- gsoap 实现 web service 的问题
- 能在编译生成exe的同时,也生成dll文件吗?如果可以的话,该加上什么样的参数?我加上了/LD 后并给有生成dll文件啊!
- 同样的代码,但PostQuitMessage(0)有时执行不了为什么?
- 如何实现用SDK创建WebBrowser(不显示),并向其中写入HTML代码打印
- vc 如何通过gpib 获取aglient 电容测试计的测量数据
- 实现隐藏功能
- 使用pictur控件和loadimage函数能打开一个jpg图像文件并显示吗?
- 如何设置VC,让其自动记录每个函数的执行时间?(呼唤大侠)
- 能不能给vc做插件,比如加入一些象类生成器一类的工具?
也就是说是不是都有Media,看看pMediaSupport的帮助。是否有
MediaSupport = True then pMediaSupport->QueryMediaType
之类的东东。
根源于VC6中的类库版本较早,MSDN2000以后的所述的函数用法新于VC6中的个别函数。具体到TAPI3中,VC6中的是4.xx版,.net中的VC是6.00.0347.
谨给以后用到的朋友一个参考!