在 C++ 中使用 DirectShow 或其他 COM 库时,我#import 哪些 DLL?
What DLLs do I #import when using DirectShow or other COM libraries in C++?
我正在尝试使用 Compiler COM Support when calling DirectShow from C++. From an earlier post 我知道我需要 #import
quartz.dll 和 qedit.dll。这样做给了我智能指针 类,比如 IGraphBuilderPtr
等,我可以看到它受 IntelliSense 支持。我现在正在尝试使用 ICaptureGraphBuilder2
,但它没有出现在 IntelliSense 中,并尝试 #import
devenum.dll、qcap.dll 给我一个 "C1803: Cannot open type library file"
。那么,有几个问题:
- 使用 DirectShow 界面时,我需要哪些 DLL
#import
?
- 一般来说,给定一个 COM 库,我如何知道我可以#import 哪些 DLL?
对于 C++ 开发,您不需要 #import
。相反,你
#include <dshow.h>
#pragma comment(lib, "strmiids.lib")
您有带 ATL 的智能指针,例如CComPtr<IFilterGraph2>
(或 QzCComPtr
只有当您开发过滤器而不是高级 DirectShow 消费者代码时才有意义)。
因此,
What DLLs do I need to #import when using DirectShow interfaces?
None.
In general, given a COM library, how do I know which DLLs I can #import?
您需要知道 DLL 名称或类型库标识符。您可以从文档或使用 COM/OLE Viewer 等 SDK 工具或通过注册表查看。我建议使用类型库标识符导入。
如果您需要 GUID,它只会在 C++ 代码中导入 DirectShow DLL,而 GUID 已弃用并从 SDK 中排除。
我正在尝试使用 Compiler COM Support when calling DirectShow from C++. From an earlier post 我知道我需要 #import
quartz.dll 和 qedit.dll。这样做给了我智能指针 类,比如 IGraphBuilderPtr
等,我可以看到它受 IntelliSense 支持。我现在正在尝试使用 ICaptureGraphBuilder2
,但它没有出现在 IntelliSense 中,并尝试 #import
devenum.dll、qcap.dll 给我一个 "C1803: Cannot open type library file"
。那么,有几个问题:
- 使用 DirectShow 界面时,我需要哪些 DLL
#import
? - 一般来说,给定一个 COM 库,我如何知道我可以#import 哪些 DLL?
对于 C++ 开发,您不需要 #import
。相反,你
#include <dshow.h>
#pragma comment(lib, "strmiids.lib")
您有带 ATL 的智能指针,例如CComPtr<IFilterGraph2>
(或 QzCComPtr
只有当您开发过滤器而不是高级 DirectShow 消费者代码时才有意义)。
因此,
What DLLs do I need to #import when using DirectShow interfaces?
None.
In general, given a COM library, how do I know which DLLs I can #import?
您需要知道 DLL 名称或类型库标识符。您可以从文档或使用 COM/OLE Viewer 等 SDK 工具或通过注册表查看。我建议使用类型库标识符导入。
如果您需要 GUID,它只会在 C++ 代码中导入 DirectShow DLL,而 GUID 已弃用并从 SDK 中排除。