1 //------------------------------------------------------------------------------
4 // Desc: DirectShow base classes.
6 // Copyright (c) 1992-2002 Microsoft Corporation. All rights reserved.
7 //------------------------------------------------------------------------------
13 // Base property page class. Filters typically expose custom properties by
14 // implementing special control interfaces, examples are IDirectDrawVideo
15 // and IQualProp on renderers. This allows property pages to be built that
16 // use the given interface. Applications such as the ActiveMovie OCX query
17 // filters for the property pages they support and expose them to the user
19 // This class provides all the framework for a property page. A property
20 // page is a COM object that supports IPropertyPage. We should be created
21 // with a resource ID for the dialog which we will load when required. We
22 // should also be given in the constructor a resource ID for a title string
23 // we will load from the DLLs STRINGTABLE. The property page titles must be
24 // stored in resource files so that they can be easily internationalised
26 // We have a number of virtual methods (not PURE) that may be overriden in
27 // derived classes to query for interfaces and so on. These functions have
28 // simple implementations here that just return NOERROR. Derived classes
29 // will almost definately have to override the message handler method called
30 // OnReceiveMessage. We have a static dialog procedure that calls the method
31 // so that derived classes don't have to fiddle around with the this pointer
33 class AM_NOVTABLE CBasePropertyPage
: public IPropertyPage
, public CUnknown
37 LPPROPERTYPAGESITE m_pPageSite
; // Details for our property site
38 HWND m_hwnd
; // Window handle for the page
39 HWND m_Dlg
; // Actual dialog window handle
40 BOOL m_bDirty
; // Has anything been changed
41 int m_TitleId
; // Resource identifier for title
42 int m_DialogId
; // Dialog resource identifier
44 static INT_PTR CALLBACK
DialogProc(HWND hwnd
,
50 BOOL m_bObjectSet
; // SetObject has been called or not.
53 CBasePropertyPage(TCHAR
*pName
, // Debug only name
54 LPUNKNOWN pUnk
, // COM Delegator
55 int DialogId
, // Resource ID
56 int TitleId
); // To get tital
59 CBasePropertyPage(CHAR
*pName
,
64 virtual ~CBasePropertyPage() { };
67 // Override these virtual methods
69 virtual HRESULT
OnConnect(IUnknown
*pUnknown
) { return NOERROR
; };
70 virtual HRESULT
OnDisconnect() { return NOERROR
; };
71 virtual HRESULT
OnActivate() { return NOERROR
; };
72 virtual HRESULT
OnDeactivate() { return NOERROR
; };
73 virtual HRESULT
OnApplyChanges() { return NOERROR
; };
74 virtual INT_PTR
OnReceiveMessage(HWND hwnd
,UINT uMsg
,WPARAM wParam
,LPARAM lParam
);
76 // These implement an IPropertyPage interface
78 STDMETHODIMP
NonDelegatingQueryInterface(REFIID riid
,void **ppv
);
79 STDMETHODIMP_(ULONG
) NonDelegatingRelease();
80 STDMETHODIMP_(ULONG
) NonDelegatingAddRef();
81 STDMETHODIMP
SetPageSite(LPPROPERTYPAGESITE pPageSite
);
82 STDMETHODIMP
Activate(HWND hwndParent
,LPCRECT prect
,BOOL fModal
);
83 STDMETHODIMP
Deactivate(void);
84 STDMETHODIMP
GetPageInfo(LPPROPPAGEINFO pPageInfo
);
85 STDMETHODIMP
SetObjects(ULONG cObjects
, LPUNKNOWN
*ppUnk
);
86 STDMETHODIMP
Show(UINT nCmdShow
);
87 STDMETHODIMP
Move(LPCRECT prect
);
88 STDMETHODIMP
IsPageDirty(void) { return m_bDirty
? S_OK
: S_FALSE
; }
89 STDMETHODIMP
Apply(void);
90 STDMETHODIMP
Help(LPCWSTR lpszHelpDir
) { return E_NOTIMPL
; }
91 STDMETHODIMP
TranslateAccelerator(LPMSG lpMsg
) { return E_NOTIMPL
; }