共用方式為


GetHitTestCookie method

Retrieves the behavior identifier, or "cookie," for the rendering behavior.

Syntax

HRESULT retVal = object.GetHitTestCookie(plCookie);

Parameters

  • plCookie [out]
    Type: LONG

    Pointer to a LONG that receives the behavior ID.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

IHTMLPaintSite::GetHitTestCookie allows a rendering behavior to retrieve the ID created for it when the behavior was created at the call to IHTMLElement2::addBehavior. This ID is the same as the IHTMLEventObj3::behaviorCookie property for an event initiated on the element to which a rendering behavior is attached.

This method is useful when multiple behaviors on a page are created and controlled by a central framework (an application or control). A rendering behavior can use this ID to identify itself to the framework that created it, which typically has saved the cookies for all the behaviors it created.