Share via


ctrlKey Property

Returns a Boolean that represents whether the CTRL key on the keyboard is pressed. True if the CTRL key is pressed. False if it is not.

expression.ctrlKey

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Example

The following example displays a message every time the user clicks on the active document telling whether the user is pressing the CTRL key. This example must be placed in a class module, and it assumes that you have declared in the General Declarations section of a class module an FPHTMLDocument object variable called "doc" using the WithEvents keyword.

Private Function doc_onclick() As Boolean
    Dim wEvent As IHTMLEventObj

    Set wEvent = window.event
    
    Select Case wEvent.ctrlKey
        Case False
            MsgBox "You are not pressing your ctrl key."
        Case True
            MsgBox "You are pressing your ctrl key."
    End Select
End Function

Applies to | IHTMLEventObj Object