共用方式為


IDispEventSimpleImpl::Advise

Call this method to establish a connection with the event source represented by pUnk.

HRESULT Advise(
   IUnknown* pUnk 
);

Parameters

  • pUnk
    [in] A pointer to the IUnknown interface of the event source object.

Return Value

S_OK or any failure HRESULT value.

Remarks

Once the connection is established, events fired from pUnk will be routed to handlers in your class by way of the event sink map.

注意

If your class derives from multiple IDispEventSimpleImpl classes, you will need to disambiguate calls to this method by scoping the call with the particular base class you are interested in.

Advise establishes a connection with the default event source, it gets the IID of the default event source of the object as determined by AtlGetObjectSourceInterface.

Requirements

Header: atlcom.h

See Also

Reference

IDispEventSimpleImpl Class

IDispEventSimpleImpl::DispEventAdvise

Concepts

Supporting IDispEventImpl

Other Resources

IDispEventSimpleImpl Members