Compartilhar via


getModifierState method

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

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

IDOMKeyboardEvent::altKey

IDOMKeyboardEvent::ctrlKey

IDOMKeyboardEvent::metaKey

IDOMKeyboardEvent::shiftKey