次の方法で共有


CBasePropertyPage Class (Windows Embedded CE 6.0)

1/6/2010

Ee492496.118a78f4-8388-4b23-844b-bd87b6ecbea6(en-US,WinEmbedded.60).gif

This 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 Class array.

For more Windows Embedded CE information, see DirectShow and COM.

Your filter must expose the ISpecifyPropertyPages:IUnknown interface. This interface contains a single method, ISpecifyPropertyPages::GetPages, which returns the CLSID of the property page. The following example shows how to implement this method:

STDMETHODIMP CMyFilter::GetPages(CAUUID *pPages)
{
    if (!pPages) return E_POINTER;
    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 INonDelegatingUnknown Interface** and for Windows Embedded CE also see DirectShow and COM**.

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.

Protected Member Variables

Member Description

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

Method Description

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

Method Description

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.

Requirements

Windows Embedded CE Windows CE 2.12 and later
Note Microsoft DirectShow applications and DirectShow filters have different include file and Library requirements
For more information, see Setting Up the Build Environment

See Also

Reference

DirectShow Classes