Partager via


CBasePropertyPage::OnConnect

 
Microsoft DirectShow 9.0

CBasePropertyPage::OnConnect

The OnConnect method provides an IUnknown pointer to the object associated with the property page.

Syntax

  virtual HRESULT OnConnect(
    IUnknown *pUnknown
);

Parameters

pUnknown

Pointer to the IUnknown interface of the object.

Return Value

The base-class implementation returns S_OK.

Remarks

The CBasePropertyPage::SetObjects method calls the OnConnect method. Override this method to store a pointer to the object specified by pUnknown. You can either store the pUnknown pointer itself, or query that pointer for other interfaces. If you store the pUnknown pointer, call AddRef before OnConnect returns.

In the CBasePropertyPage::OnActivate method, use the stored pointer (or pointers) to retrieve initial values for the dialog properties. In the CBasePropertyPage::OnApplyChanges method, apply any changes back to the object. Release all pointers in the CBasePropertyPage::OnDisconnect method.

Example Code

HRESULT CMyProp::OnConnect(IUnknown *pUnk)
{
    ASSERT(m_pOwningFilter == NULL);
    HRESULT hr;
    // Query pUnk for the filter's custom interface.
    hr = pUnk->QueryInterface(IID_ISomeCustomInterface,
             reinterpret_cast<void**>(&m_pOwningFilter));
    return hr;
}

Requirements

**  Header:** Declared in Cprop.h; include Streams.h.

**  Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

See Also