Microsoft DirectX 8.1 (C++) |
The CBasePropertyPage class is an abstract class for implementing a property page. Use this class if you are writing a filter (or other object) that supports property pages.
A property page is a COM object, so you must generate a GUID for the class identifier (CLSID) and provide an entry in the CFactoryTemplate array. For more information, see DirectShow and COM. The following example shows a typical class factory entry:
CFactoryTemplate g_Templates[] =
{
{
L"My Property Page",
&CLSID_MyPropPage,
CMyProp::CreateInstance
},
/* Also include the template for your filter (not shown). */
};
Your filter must expose the ISpecifyPropertyPages interface. This interface contains a single method, GetPages, which returns the CLSID of the property page. The following example shows how to implement this method:
STDMETHODIMP CMyFilter::GetPages(CAUUID *pPages)
{
pPages->cElems = 1;
pPages->pElems = reinterpret_cast<GUID*>(CoTaskMemAlloc(sizeof(GUID)));
if (pPages->pElems == NULL)
{
return E_OUTOFMEMORY;
}
*(pPages->pElems) = CLSID_MyPropPage;
return S_OK;
}
Remember to override the filter's NonDelegatingQueryInterface method as well. For more information, see DirectShow and COM and INonDelegatingUnknown.
Next, create the dialog as a resource in your project, and create a string resource that holds the dialog title. Both of these resource IDs are parameters to the CBasePropertyPage constructor. Keeping the title string in a resource makes it easier to localize your property page.
The CBasePropertyPage class provides a framework for the IPropertyPage interface. This framework calls a number of virtual methods, including CBasePropertyPage::OnActivate, CBasePropertyPage::OnApplyChanges, and so on. In the base class, these methods simply return S_OK. Your derived class will need to override some or all of these virtual methods. For details, see the remarks for the individual methods.
Requirements
Header: Declared in Cprop.h; include Streams.h.
Library: Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).
Protected Member Variables | |
m_bDirty | Indicates whether any of the properties have changed. |
m_DialogId | Resource identifier for the dialog. |
m_Dlg | Handle to the dialog window. |
m_hwnd | Handle to the dialog window. |
m_pPageSite | Pointer to the IPropertyPageSite interface of the property page site. |
m_TitleId | Resource identifier for a string that contains the dialog title. |
Public Methods | |
CBasePropertyPage | Constructor method. |
~CBasePropertyPage | Destructor method. Virtual. |
OnActivate | Called when the property page is activated. Virtual. |
OnApplyChanges | Called when the user applies changes to the property page. Virtual. |
OnConnect | Provides an IUnknown pointer to the object associated with the property page. Virtual. |
OnDeactivate | Called when the dialog box window is destroyed. Virtual. |
OnDisconnect | Called when the property page should release the associated object. Virtual. |
OnReceiveMessage | Called when the dialog box receives a message. Virtual. |
IPropertyPage Methods | |
Activate | Creates the dialog box window. |
Apply | Applies the current property page values to the object associated with the property page |
Deactivate | Destroys the dialog window. |
GetPageInfo | Retrieves information about the property page. |
Help | Invokes the property page help. |
IsPageDirty | Indicates whether the property page has changed since it was activated or since the most recent call to IPropertyPage::Apply. |
Move | Positions and resizes the dialog box. |
SetObjects | Provides IUnknown pointers for the objects associated with the property page. |
SetPageSite | Initializes the property page. |
Show | Shows or hides the dialog box. |
TranslateAccelerator | Instructs the property page to process a keystroke. |