Microsoft DirectX 9.0


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


virtual HRESULT OnConnect(
    IUnknown *pUnknown



Pointer to the IUnknown interface of the object.

Return Value

The base-class implementation returns S_OK.


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,
    return hr;

See Also