initMouseEvent method
Initializes a new mouse event that the IDocumentEvent::createEvent method created.
![]() ![]() |
Syntax
HRESULT retVal = object.initMouseEvent(eventType, canBubble, cancelable, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, buttonArg, relatedTargetArg);
Parameters
- eventType [in]
-
Type: BSTR
One of the following values, or a user-defined custom event type.
-
An HTMLFrameSiteEvents::onclick event. A mouse button is clicked over an element. A click is a mousedown event and mouseup event in the same location. The value of detailArg increases for each click in the same area.
-
An HTMLFrameSiteEvents::ondblclick event. A mouse button is double-clicked over an element.
-
An HTMLFrameSiteEvents::onmousedown event. A mouse button is pressed over an element.
-
An HTMLFrameSiteEvents::onmousemove event. The mouse pointer moves over an element.
-
An HTMLFrameSiteEvents::onmouseout event. The mouse pointer moves outside the boundaries of an element.
-
An HTMLFrameSiteEvents::onmouseover event. The mouse pointer moves into the boundaries of an element.
-
An HTMLFrameSiteEvents::onmouseup event. A mouse button is released over an element.
- canBubble [in]
-
Type: VARIANT_BOOL
- cancelable [in]
-
Type: VARIANT_BOOL
- viewArg [in]
-
Type: IHTMLWindow2
An IHTMLWindow2 variable that specifies the active window, or NULL. This value is returned in the IDOMUIEvent::view property of the event. - detailArg [in]
-
Type: long
A number that can provide additional information about the event. This value is returned in the IDOMUIEvent::detail property of the event.
- screenXArg [in]
-
Type: long
The x-coordinate of the mouse pointer, relative to the upper-left corner of the screen. This value is returned in the IDOMMouseEvent::screenX property of the event.
- screenYArg [in]
-
Type: long
The y-coordinate of the mouse pointer, relative to the upper-left corner of the screen. This value is returned in the IDOMMouseEvent::screenY property of the event.
- clientXArg [in]
-
Type: long
The x-coordinate of the mouse pointer, relative to the upper-left corner of the browser's client area. This value is returned in the IDOMMouseEvent::clientX property of the event.
- clientYArg [in]
-
Type: long
The y-coordinate of the mouse pointer, relative to the upper-left corner of the browser's client area. This value is returned in the IDOMMouseEvent::clientY property of the event.
- ctrlKeyArg [in]
-
Type: VARIANT_BOOL
The value that is returned in the IDOMMouseEvent::ctrlKey property of the event.
- altKeyArg [in]
-
Type: VARIANT_BOOL
The value that is returned in the IDOMMouseEvent::altKey property of the event.
- shiftKeyArg [in]
-
Type: VARIANT_BOOL
The value that is returned in the IDOMMouseEvent::shiftKey property of the event.
- metaKeyArg [in]
-
Type: VARIANT_BOOL
The value that is returned in the IDOMMouseEvent::metaKey property of the event.
- buttonArg [in]
-
Type: unsigned short
The mouse button that caused the event. This value is returned in the IDOMMouseEvent::button property of the event.
- relatedTargetArg [in]
-
Type: IEventTarget
A reference to the related element. For more information about how related elements are used with mouse events, see IDOMMouseEvent::relatedTarget.
Return value
Type: HRESULT
If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Standards information
- Document Object Model (DOM) Level 3 Events Specification, Section 5.2.3
See also

