[与此页面关联的功能(自定义文件和流处理程序)是一项旧功能。 它已被 MediaStreamSource 类取代。 MediaStreamSource 类 已针对 Windows 10 和 Windows 11 进行了优化。 Microsoft强烈建议新代码尽可能使用 MediaStreamSource 类 而不是 自定义文件和流处理程序。 Microsoft建议重写使用旧 API 的现有代码,以尽可能使用新 API。]
QueryInterface 方法允许应用程序查询对象以确定它支持的接口。 示例应用程序将 ppv 指针设置为当前接口。
STDMETHODIMP CAVIFileCF::QueryInterface(
const IID FAR& iid,
void FAR* FAR* ppv)
{
if (iid == IID_IUnknown)
*ppv = this; // set the interface pointer
// to this instance
else if (iid == IID_IClassFactory)
*ppv = this; // second chance to set the
// interface pointer to this
// instance
else
return ResultFromScode(E_NOINTERFACE);
AddRef(); //Increment the reference count
return NULL;
}