GefObjectEvent.KeyModifierFlags (read-only property)

Represents the modifier flags used with the key this corresponds to.
Syntax: long = object.KeyModifierFlags
Description: The modifier flags are a combination of the values from the GefKeyModifierFlags enumeration.

This property is only valid for events whose Type is gefEventKeyDown, gefEventKeyUp, or gefEventWhileKeyDown.

You can set this property with the SetKey method.

Example:

Sub GefObjectEvent_KeyModifierFlags()
    
    Dim oCimObj As GefObject
    Dim oCimObjEvnts As GefObjectEvents
    Dim oCimObjEvnt As GefObjectEvent
    Dim nKeyModFlags As Long
    Dim strAlt As String
    Dim strControl As String
    Dim strShift As String
    Dim strMessage As String
    
    strAlt = ""
    strControl = ""
    strShift = ""
    strMessage = ""
    
    Set oCimObj = CimGetObject
    Set oCimObjEvnts = oCimObj.Events
    Set oCimObjEvnt = oCimObjEvnts.Item(0)
    nKeyModFlags = oCimObjEvnt.KeyModifierFlags
    If (nKeyModFlags And 2 ^ 0) = 2 ^ 0 Then
        strAlt = "ALT key"
    End If
    If (nKeyModFlags And 2 ^ 1) = 2 ^ 1 Then
        strControl ="Contol Key"
    End If
    If (nKeyModFlags And 2 ^ 2) = 2 ^ 2 Then
        strShift ="Shift Key"
    End If
    If strAlt <> "" Then
        strMessage = strAlt
    End If
    If strControl <> "" Then
        If strMessage <> "" Then
            strMessage = strMessage & " and " & strControl
        Else
            strMessage = strControl
        End If
    End If
    If strShift <> "" Then
        If strMessage <> "" Then
            strMessage = strMessage & " and " & strShift
        Else
            strMessage = strShift
        End If
    End If
    If strMessage <> "" Then
        MsgBox "The " & strMessage & " are needed for the event " & _
            "to run"
    Else
        MsgBox "Alt, Control, or Shift are not needed for the event"
    End If
    
End Sub