GetEventTarget method

Called by MSHTML after a successful hit-test on a rendering behavior to transfer event handling to another element.


HRESULT retVal = object.GetEventTarget(ppElement);


  • ppElement [out]
    Type: [IHTMLElement](aa752279(v=vs.85).md)

    Pointer to an IHTMLElement interface for the element to which to transfer the event.

Return value


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


This method is called only if IHTMLPainterEventInfo::GetEventInfoFlags passes MSHTML the HTMLPAINT_EVENT_TARGET flag.

When a hit-test on a rendering behavior is successful, the behavior can transfer the event to another element to use that element's event handlers. For example, an editing application might redirect all mouse events from selected elements to some central element in the framework, so it can drag all the selected elements together. The IHTMLEventObj::srcElement property in the event object for the event will remain the element to which the behavior is attached.