
This interface provides access to the event processes, such as the element in which the event occurred, the state of the keyboard keys, the location of the mouse, and the state of the mouse buttons.
The event object is only available during an event, that is, you can use it in event handlers but not in other code. You retrieve the event object by calling the IHTMLWindow2::get_event method.
Although all event properties are available to all event objects, some properties might not have meaningful values during some events. For example, the values retrieved by the get_fromElement and the get_toElement methods are meaningful only when processing the onmouseover and onmouseout events.
IHTMLEventObj Methods
HRESULT get_srcElement(
IHTMLElement **p
);
Retrieves an interface pointer for the object in which the event occurred.
HRESULT get_altKey(
VARIANT_BOOL *p
);
Retrieves the state of the ALT key.
HRESULT get_ctrlKey(
VARIANT_BOOL *p
);
Retrieves the state of the CTRL key.
HRESULT get_shiftKey(
VARIANT_BOOL *p
);
Retrieves the state of the SHIFT key.
HRESULT put_returnValue(
VARIANT v
);
Sets the return value of the event.
For event handler functions, the value of this property takes precedence over values returned by the function, such as through a return statement.
See also get_returnValue
HRESULT get_returnValue(
VARIANT *p
);
Retrieves the return value of the event or dialog.
For event handler functions, the value of this property takes precedence over values returned by the function, such as through a return statement.
See also put_returnValue
HRESULT put_cancelBubble(
VARIANT_BOOL v
);
Sets whether the current event should bubble up the hierarchy of event handlers.
Using this property to cancel bubbling for an event does not affect subsequent events.
See also get_cancelBubble
HRESULT get_cancelBubble(
VARIANT_BOOL *p
);
Retrieves whether the current event should bubble up the hierarchy of event handlers.
Using this property to cancel bubbling for an event does not affect subsequent events.
See also put_cancelBubble
HRESULT get_fromElement(
IHTMLElement **p
);
Retrieves the object being moved from for the onmouseover and onmouseout events.
HRESULT get_toElement(
IHTMLElement **p
);
Retrieves the object being moved to for the onmouseover and onmouseout events.
HRESULT put_keyCode(
long v
);
Sets the Unicode key code associated with the key that caused the event.
If you set this property, the given key code replaces the existing value. Subsequent event handlers receive the new value rather than the original.
This property is intended to be used with the onkeydown, onkeyup, and onkeypress events.
See also get_keyCode
HRESULT get_keyCode(
long *p
);
Retrieves the Unicode key code associated with the key that caused the event.
If you set this property, the given key code replaces the existing value. Subsequent event handlers receive the new value rather than the original.
This property is intended to be used with the onkeydown, onkeyup, and onkeypress events.
See also put_keyCode
HRESULT get_button(
long *p
);
Retrieves which mouse button, if any, is pressed.
| 0 | No button. |
| 1 | Left button is pressed. |
| 2 | Right button is pressed. |
| 4 | Middle button is pressed. |
This property is intended to be used with the onmousedown, onmouseup, and onmousemove events. For other events, it typically is 0 regardless of the state of the mouse buttons.
HRESULT get_type(
BSTR *p
);
Retrieves the event name as a string.
Events are returned without the "on" prefix. For example, the "onclick" event is returned as "click".
HRESULT get_qualifier(
BSTR *p
);
Specifies the event qualifier.
HRESULT get_reason(
long *p
);
Retrieves the disposition of data transfer for a data source object.
| 0 | Data transmitted successfully. |
| 1 | Data transfer aborted. |
| 2 | Data transfer in error. |
HRESULT get_x(
long *p
);
Retrieves the position of the mouse hit relative to the object in the parent heirarchy that is positioned using the CSS positioning attribute. If no object in the heirarchy has been positioned, the BODY is the default.
If the mouse is outside the window when the event is called, this property returns -1.
See also get_y
HRESULT get_y(
long *p
);
Retrieves the position of the mouse hit relative to the object in the parent heirarchy that is positioned using the CSS positioning attribute. If no object in the heirarchy has been positioned, the BODY is the default.
If the mouse is outside the window at the time the event fires, this property returns -1.
See also get_x
HRESULT get_clientX(
long *p
);
Retrieves the horizontal position of the mouse hit relative to the top of the client area of the window. This does not include window decorations or scroll bars.
See also get_clientY
HRESULT get_clientY(
long *p
);
Retrieves the vertical position of the mouse hit relative to side of the client area of the window. This does not include window decorations or scroll bars.
See also get_clientX
HRESULT get_offsetX(
long *p
);
Returns container-relative positions. These match the offsetLeft and offsetTop properties of the object. Use offsetParent to find the container object that defines this coordinate system.
See also get_offsetY
HRESULT get_offsetY(
long *p
);
Returns container-relative positions. These match the offsetLeft and offsetTop properties of the object. Use offsetParent to find the container object that defines this coordinate system.
See also get_offsetX
HRESULT get_screenX(
long *p
);
Returns coordinates relative to the physical screen size.
See also get_screenY
HRESULT get_screenY(
long *p
);
Returns coordinates relative to the physical screen size.
See also get_screenX
HRESULT get_srcFilter(
BSTR *p
);
Specifies the filter object that caused the onfilterchange event.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.