HitTestPoint method

Called by MSHTML to retrieve a value that specifies whether a point is contained in a rendering behavior.

Syntax

HRESULT retVal = object.HitTestPoint(pt, pbHit, plPartID);

Parameters

  • pt [in]
    Type: POINT

    POINT structure that specifies the point clicked relative to the top-left corner of the element to which the behavior is attached.

  • pbHit [out, retval]
    Type: BOOL

    Pointer to a variable of type BOOL that receives TRUE if the point is contained in the element to which the rendering behavior is attached, or FALSE otherwise.

  • plPartID [out]
    Type: LONG

    Pointer to a variable of type LONG that receives a number identifying which part of the behavior has been hit.

Return value

Type: HRESULT

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

Remarks

MSHTML calls this method when calls are made to such methods as IHTMLDocument2::elementFromPoint or IHTMLElement2::componentFromPoint that need to determine how a point relates to the elements in a document's object tree. The behavior then can determine how the element to which it is attached handles events. In particular, the plPartID parameter enables a rendering behavior to assign identification numbers for different parts of the behavior. The value of this parameter is stored as an event object property. For example, a resizing behavior could return a unique value in plPartID for each of its sizing handles. The IHTMLPainter::Draw method could then query the event object for this value to determine in which direction to resize an element as the user drags the sizing handle.

When the behavior is rendered below the flow layer of an element, the plPartID returned by this method is not passed to the event object. Instead, the event object contains information provided by the objects in the flow layer, above the behavior. The lZOrder member of the HTML_PAINTER_INFO structure specified by IHTMLPainter::GetPainterInfo determines whether the behavior is above or below the flow layer.