自定义 Directshow 过滤器的属性页

发布于 2024-10-17 08:07:28 字数 1555 浏览 5 评论 0原文

我设法创建一个自定义 DirectShow 转换过滤器,注册它,并将其导出到 DLL 中。现在它可以在 GraphEdit 和 C++ 测试程序中正常工作。我的下一个目标是创建一个自定义界面来从测试应用程序或 GraphEdit 中的属性页控制过滤器的主要参数。

按照这些说明,我得到了我的自定义接口在 C++ 测试程序中正常工作。但是,我在属性页方面遇到了困难:我在 GraphEdit 中不断收到错误消息“无法显示请求的属性页”。

在调试时,我发现调用的唯一方法(在我的自定义属性页类中,从 CBasePropertyPage 派生)是 OnConnect()OnDisconnect() - 这很奇怪(或不是吗?)打了两次电话。在这两个方法之间,对 CBasePropertyPage 方法进行了一些调用(基类中的文件 cprop.cpp),一切看起来都很好,直到:

STDMETHODIMP CBasePropertyPage::Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal)

和更准确地说,

m_hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(m_DialogId), hwndParent, DialogProc, (LPARAM) this);

我总是得到 m_hwnd 为 0,导致该方法返回一个错误。我尝试在这条指令之后添加 GetLastError() ,但它总是返回 0,没有错误。此外,CreateDialogParam() 的每个参数看起来都已正确初始化...

任何帮助将不胜感激!


编辑

目前,为了至少有一个工作示例,我使用了 MSDN 教程


---编辑2---

在进行更多调试时,我尝试从对话框资源中删除每个控件(按钮、滚动条)。之后......一切正常。 CreateDialogParam() 返回正确的值,调用我的类的 OnActivate() 等等。我最终在 GraphEdit 中得到一个“过滤器属性”页面,但它是空的(默认对话框窗口除外)。

但是一旦我有了一个控件,例如MF命令按钮,前面的问题就出现了。

DirectShow 基类和我使用的控件之间是否存在任何类型的不兼容? (如果是这样,为什么提供的示例没有提及任何内容?)是否有更简单的方法将控件添加到属性页?

(我绝对不是 GUI 和 Win32 控件方面的专家...)

I managed to create a custom DirectShow transform filter, register it, and export it in a DLL. It now works properly in both GraphEdit and a C++ test program. My next goal is to create a custom interface to control the filter's main parameter, from a test app or from a property page in GraphEdit.

Following these instructions, I got my custom interface working properly from the C++ test program. However, I'm facing difficulties with the property page : I keep getting the error message "The requested property page could not be displayed" in GraphEdit.

While debugging, I found that the only methods called (in my custom property page class, derived from CBasePropertyPage) are OnConnect() and OnDisconnect() - which is oddly (or not ?) called twice. Between these two methods, some calls are made to CBasePropertyPage methods (file cprop.cpp in baseclasses), and everything looks fine until :

STDMETHODIMP CBasePropertyPage::Activate(HWND hwndParent, LPCRECT pRect, BOOL fModal)

and more precisely

m_hwnd = CreateDialogParam(g_hInst, MAKEINTRESOURCE(m_DialogId), hwndParent, DialogProc, (LPARAM) this);

I always get m_hwnd at 0, causing the method to return with an error. I tried to add GetLastError() right after this instruction, but it always returns 0, no error. Moreover, every parameter of CreateDialogParam() looks properly initialized...

Any help would be greatly appreciated !

EDIT :

For now, in order to at least have a working example, I've used the same resources/templates described in the MSDN tutorial.

---EDIT 2--- :

While debugging a little bit more, I tried deleting every single control (button, scroller) from the Dialog resource. After that... everything works. CreateDialogParam() returns a correct value, my class's OnActivate() is called and so on. I eventually get a "filter properties" page in GraphEdit, but empty (except from the default dialog window).

But as soon as I had a control, e.g. a MF command button, the previous problems appear.

Is there any kind of incompatibility between DirectShow base classes and the controls I use ? (And if so, why isn't the provided sample mentioning anything ?) Is there any simpler way to add controls to the property page ?

(I'm definitely not an expert with GUIs and Win32 controls...)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我家小可爱 2024-10-24 08:07:28

看起来问题出在我为属性页创建控件的方式上。我使用简单的“Formview”资源,但我试图通过图形资源查看器(或任何您想要的名称)添加控件:右键单击“插入 ActiveX 控件...”并使用“Microsoft Form 2.0” 。

使用具有普通旧 Win32 控件的 Formview 资源(使用 CreateWindowEx() 初始化并使用经典消息循环进行管理),一切顺利。

非常感谢您的帮助!

Looks like the problem came from the way I was creating the controls for the Property Page. I use a simple "Formview" resource, but I was trying to add the controls through the graphical resource viewer (or whatever you want to call it) : right click, "Insert ActiveX Control..." and using "Microsoft Form 2.0".

Using a Formview resource with plain old Win32 controls (initialized with CreateWindowEx() and managed with a classic message loop), everything went ok.

Thanks a lot for your help !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文