Compartilhar via


initMouseWheelEvent method

Initializes a new mouse wheel event that the IDocumentEvent::createEvent method created. For the standards based method, see IDOMWheelEvent::initWheelEvent.

 

Syntax

HRESULT retVal = object.initMouseWheelEvent(eventType, canBubble, cancelable, view, detail, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, wheelDeltaArg);

Parameters

eventType [in]

Type: BSTR

The following value, or a user-defined custom event type.

mousewheel

An HTMLFrameSiteEvents::onmousewheel event. The mouse wheel rotates upward or downward.

canBubble [in]

Type: VARIANT_BOOL

VARIANT_TRUE (true)

The event should propagate upward.

VARIANT_FALSE (false)

The event does not propagate upward.

cancelable [in]

Type: VARIANT_BOOL

VARIANT_TRUE (true)

The default action can be canceled.

VARIANT_FALSE (false)

The default action cannot be canceled.

view [in]

Type: IHTMLWindow2

An IHTMLWindow2 variable that specifies the active window, or NULL. This value is returned in the IDOMUIEvent::view attribute of the event.

detail [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.

buttonArg [in]

Type: unsigned short

The mouse button that caused the event. This value is returned in the IDOMMouseEvent::button property of the event.

0

No mouse button is pressed.

1

The left mouse button is pressed.

2

The right mouse button is pressed.

relatedTargetArg [in]

Type: IEventTarget

A reference to the related element. For more information about how related elements are used with mouse events, see IDOMFocusEvent::relatedTarget.

modifiersListArg [in]

Type: BSTR

A space-separated list of any of the following values:

Alt

The left or right Alt key is pressed.

AltGraph

The Ctrl and Alt keys are pressed.

CapsLock

The Caps Lock toggle is enabled.

Control

The left or right Ctrl key is pressed.

Meta

The Meta/Control key is pressed.

NumLock

The Num Lock toggle is enabled.

Scroll

The Scroll Lock toggle is enabled.

Shift

The left or right Shift key is pressed.

Win

The left or right Windows logo key is pressed.

wheelDeltaArg [in]

Type: long

The distance that the wheel has rotated around the y-axis (vertically). This value is returned in the IDOMMouseWheelEvent::wheelDelta property of the event.

Return value

Type: HRESULT

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

Standards information

There are no standards that apply here.

Remarks

A MouseWheelEvent event can capture wheel movement along a vertical axis only. To capture movement in all directions, use WheelEvent instead.

See also

IDOMWheelEvent::initWheelEvent