PreHandleEvent method

Called by MSHTML before the MSHTML Editor processes an event, so that the designer can provide its own event handling behavior.


HRESULT retVal = object.PreHandleEvent(inEvtDispId, pIEventObj);


  • inEvtDispId [in]
    Type: DISPID

    A DISPID that specifies the event.

  • pIEventObj [in]
    Type: [IHTMLEventObj](aa703876(v=vs.85).md)

    A pointer to an IHTMLEventObj interface that specifies the event.


MSHTML calls this method before it processes an event in the editor's environment. In a custom editor implementation, this method enables you to modify the behavior of an event before the MSHTML Editor processes it.

The DISPID parameter provides the most efficient way for an IHTMLEditDesigner method to determine what type of event triggered the method call. The DISPID_HTMLELEMENTEVENTS2 identifiers are defined in Mshtmdid.h.

Note IME events do not have DISPIDs, so the DISPID parameter is zero for any IME event. If a designer handles IME events and the DISPID is zero, the designer can determine the event type from the IHTMLEventObj::srcElement property.