Datalogic .NET SDK
KeybdGetKeyInputState (Method)
Syntax
public static UInt32 KeybdGetKeyInputState();
Description
Retrieves the current key input state of the keyboard.
Parameters Table
|
Type |
Parameter |
Description |
[in] |
void |
|
- |
|
|
|
|
[returns] |
UInt32 |
|
A value that is the result of the bitwise OR'ing of constant values defined in the KbdState. |
[on error] |
KbdState.StateError |
- |
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"); }
|
Remarks
If ALL KbdState are OR’ed together we will expect: "0x28AA".
See Also
Device.KbdState (Enum), Example #036.
Copyright © Datalogic ADC. All Right Reserved