Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Queries the state of the specified modifier key.
![]() ![]() |
Syntax
HRESULT retVal = object.getModifierState(keyArg, state);
Parameters
keyArg [in]
Type: BSTR
Alt
The left or right Alt key.
AltGraph
The Ctrl and Alt keys.
CapsLock
The Caps Lock toggle.
Control
The left or right Ctrl key.
Meta
The Meta/Control key.
NumLock
The Num Lock toggle.
Scroll
The Scroll Lock toggle.
Shift
The left or right Shift key.
Win
The left or right Windows logo key.
state [out, retval]
Type: VARIANT_BOOL
VARIANT_TRUE if the modifier key is active; otherwise, VARIANT_FALSE.
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
Remarks
Some keyboard configurations contain a left and right modifier key. To determine whether the left or right key is pressed, use the IDOMKeyboardEvent::location property.
See also
Reference