2.2.3.26 KeyInfo

This data type represents information about a keyboard event.

This data type is a Complex Object (see section 2.2.5.2 and 2.2.5.2.8) with the following extended properties (see section 2.2.5.2.9):

  • A virtual key code that identifies the given key in a device-independent manner.

    • Property name: virtualKeyCode

    • Property type: Signed Int (see section 2.2.5.1.11).

  • Character corresponding to the pressed keys.

    • Property name: character

    • Property type: Character (see section 2.2.5.1.2).

  • State of the control keys.

    • Property name: controlKeyState

    • Property type: ControlKeyStates (see section 2.2.3.27).

  • True if the event was generated when a key was pressed; false otherwise.

    • Property name: keyDown

    • Property type: Boolean (see section 2.2.5.1.3).

The Complex Object described in this section SHOULD have no associated type names (section 2.2.5.2.3).

Example (inside a PIPELINE_HOST_RESPONSE message):

 <Obj RefId="0">
   <MS>
     <Obj N="mr" RefId="1">
       <MS>
         <I32 N="virtualKeyCode">65</I32>
         <C N="character">97</C>
         <I32 N="controlKeyState">0</I32>
         <B N="keyDown">true</B>
       </MS>
     </Obj>
     <I64 N="ci">1</I64>
     <Obj N="mi" RefId="2">
       <TN RefId="0">
         <T>System.Management.Automation.Remoting.RemoteHostMethodId</T>
         <T>System.Enum</T>
         <T>System.ValueType</T>
         <T>System.Object</T>
       </TN>
       <ToString>ReadKey</ToString>
       <I32>46</I32>
     </Obj>
   </MS>
 </Obj>