开发者

Property page for custom Directshow filter

开发者 https://www.devze.com 2023-02-11 11:58 出处:网络
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 interf

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...)


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 !

0

精彩评论

暂无评论...
验证码 换一张
取 消