Datalogic .NET SDK

KeybdSetKeyInputState (Method)

 

Syntax

 

   public static Boolean KeybdSetKeyInputState (UInt32 State);

 

 

Class                           : Device

Namespace                : Datalogic.API

Assembly                   : Datalogic.API.DLL

 

 

Description

Sets the key input state for the keyboard. If multiple states are activated it is possible, depending on the keyboard, for one state to be deactivated by another when states are being turned on.

 

 

 

Parameters Table

 

Type

Parameter

Description

[in]

UInt32

State

An value generated by OR'ing the KbdState enum constant values.  These are the values that can be returned by Datalogic.API.Device.KeybdGetKeyInputState.

State key down flags are ignored.

 

 

 

 

[returns]

Boolean

 

Returns TRUE if the state was successfully set, otherwise returns FALSE.

[on error]

FALSE

 

-

 

 

Example

 

       private void btnSetGetInputState_Click(object sender, EventArgs e)

        {

            uint InputStateValue = 0;

            uint[] StateArray = new uint[12];

            bool b = false;

 

            StateArray[0] = (chAltDown.Checked) ? (uint)Device.KbdState.AltDown : (uint)0;

            StateArray[1] = (chAltOn.Checked)   ? (uint)Device.KbdState.AltOn : (uint)0;

            StateArray[2] = (chBlueDown.Checked)? (uint)Device.KbdState.BlueDown : (uint)0;

            StateArray[3] = (chBlueOn.Checked)  ? (uint)Device.KbdState.BlueOn : (uint)0;

            StateArray[4] = (chCapsDown.Checked)? (uint)Device.KbdState.CapsDown : (uint)0;

            StateArray[5] = (chCapsOn.Checked)  ? (uint)Device.KbdState.CapsOn : (uint)0;

            StateArray[6] = (chCtrlDown.Checked)? (uint)Device.KbdState.CtrlDown : (uint)0;

            StateArray[7] = (chCtrlOn.Checked)  ? (uint)Device.KbdState.CtrlOn : (uint)0;

            StateArray[8] = (chShiftDown.Checked)?(uint)Device.KbdState.ShiftDown : (uint)0;

            StateArray[9] = (chShiftOn.Checked) ? (uint)Device.KbdState.ShiftOn : (uint)0;

            StateArray[10] = (chYellDown.Checked)?(uint)Device.KbdState.YellowDown : (uint)0;

            StateArray[11] = (chYellOn.Checked) ? (uint)Device.KbdState.YellowOn : (uint)0;

 

            for (int i = 0; i < 12; i++)

                InputStateValue |= StateArray[i];

 

            // Set Input state

            b = Device.KeybdSetKeyInputState(InputStateValue);

 

            // Get state as hexadecimal value.

            // Note: if ALL checkbox are checked as True we will expect: "0x28AA".

            uint GetInState = Device.KeybdGetKeyInputState();

            txtGetInState.Text = "0x" + GetInState.ToString("X");

        }

 

 

 

See Also

Device.KbdState (Enum), Device.KeybdGetKeyInputState (Method), Example #036.

 

 

Copyright © Datalogic ADC. All Right Reserved