initKeyboardEvent method
Initializes a new keyboard event that the IDocumentEvent::createEvent method created.
![]() ![]() |
Syntax
HRESULT retVal = object.initKeyboardEvent(eventType, canBubble, cancelable, viewArg, keyArg, locationArg, modifiersListArg, repeat, locale);
Parameters
- eventType [in]
-
Type: BSTR
One of the following values, or a user-defined custom event type.
-
An HTMLFrameSiteEvents::onkeydown event.
-
An HTMLFrameSiteEvents::onkeypress event.
-
An HTMLFrameSiteEvents::onkeyup event.
- 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. - keyArg [in]
-
Type: BSTR
The key identifier. This value is returned in the IDOMKeyboardEvent::key property of the event.
- locationArg [in]
-
Type: unsigned long
The location of the key on the device. This value is returned in the IDOMKeyboardEvent::location property of the event.
- modifiersListArg [in]
-
Type: BSTR
A space-separated list of any of the following values:
-
The left or right Alt key is pressed.
-
The Ctrl and Alt keys are pressed.
-
The Caps Lock toggle is enabled.
-
The left or right Ctrl key is pressed.
-
The Meta/Control key is pressed.
-
The Num Lock toggle is enabled.
-
The Scroll Lock toggle is enabled.
-
The left or right Shift key is pressed.
-
The left or right Windows logo key is pressed.
- repeat [in]
-
Type: VARIANT_BOOL
Indicates whether the event should repeat.
- locale [in]
-
Type: BSTR
The locale name. This value is returned in the IDOMKeyboardEvent::locale attribute of the event.
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.6

