Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shift key handling #5

Open
matosimi opened this issue Aug 24, 2017 · 1 comment
Open

Shift key handling #5

matosimi opened this issue Aug 24, 2017 · 1 comment

Comments

@matosimi
Copy link

Hi, I like this project however I bumped into fact that it does not handle shift key properly... I am using it to send password characters (which obviously can contain capital letters and special characters that you type with shift key)... so this solution works well if you like to type "hello world3" however it does not work when you would like to type "Hello WoRLD#"... because capital letters will be replaced by normal ones...for the reason that this capitalization is somehow omitted in the code, yet it is quite prepared to support it... so here is my solution:

replace GetVirtualKeyCode method in Messaging.cs with following one:

public static uint GetVirtualKeyCode(char c, bool getShiftState = false)
{
 var helper = new Helper { Value = VkKeyScan(c) };
 byte virtualKeyCode = helper.Low;
 byte shiftState = helper.High;
 if (getShiftState)
  return shiftState;
 else return virtualKeyCode;
}

then replace Key(char c) constructor in Key.cs:

public Key(char c)
{
 _buttonCounter = 0; 
 Vk = (Messaging.VKeys)Messaging.GetVirtualKeyCode(c);
 ShiftKey = Messaging.VKeys.NULL;
 ShiftType = (Messaging.ShiftType)Messaging.GetVirtualKeyCode(c, true); 
}

...and suddenly Keyboard supports capital letters :)...and it can be tested with KeybordDemo right away.

@EasyAsABC123
Copy link
Owner

Put in a PR and I'll accept it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants