Modified code for Italian keymap and notebook Fn + Numpad keys when block num deactivated

Topics: Feature requests
Aug 14, 2013 at 5:07 PM
Various chars like " or @ or . not woking. Also when pressing : showed ; in remote.

Also if I move mouse in host computer this return on client set position and client not updated

I have only this 3 issue:

too slow and unusable

keyboard Keys not return some corrected codes.

Mouse cannot move when client is connected.
Aug 15, 2013 at 7:30 PM
I have modified source of robot.cs because in IT map (italian) some Keys like "." or "," not work and also others keys like ":" is mapped to ";" key or not working.

Note: this only for italian keymap tested with standard keyboard and notebook keyboard (also mapped fn + keypad keys for numbers if not numlock enabled, tested in FSC Notebook Amilo SI1520)
Part 1:
 public static KeyCode toVKCode(int paramInt)
            {
                
                KeyCode localKeyCode = null;
                bool chk = false;
                int i = 0;
                Console.WriteLine(paramInt);
                if ((paramInt >= 65) && (paramInt <= 90))
                {
                    i = paramInt;
                    chk = true;
                }
                else if ((paramInt >= 48) && (paramInt <= 57))
                {
                    i = paramInt;
                }
                else if ((paramInt >= 97) && (paramInt <= 122))
                {
                    i = paramInt - 97 + 65;
                    chk = true;
                }
                else if (((paramInt == 32)) || ((paramInt >= 58) && (paramInt <= 64)) || (paramInt == 8364) || ((paramInt >= 65360) && (paramInt <= 65367)) || (paramInt == 65535))
                {
                    i = paramInt;
                    chk = true;         
                }
                else if (((paramInt >= 91) && (paramInt <= 93)) || (paramInt == 95) || (paramInt == 96))
                {
                    i = paramInt;
                    chk = true;
                }
                else if ((paramInt >= 126) && (paramInt <= 255))
                {
                    i = paramInt;
                    chk = true;
                }
                else if ((paramInt == 65507))
                {
                    altgr = !altgr;
                    if (altgr) 
                    {
                        i = paramInt;
                        chk = true;
                    }

                }
                else
                {
                    Console.WriteLine(paramInt);


                    switch (paramInt)
                    {
                        case 33:
                            i = 49;
                            chk = true;
                            break;
                        case 34:
                            i = 50;
                            chk = true;
                            break;
                        case 35:
                            i = 35;
                            chk = true;
                            break;
                        case 36:
                            i = 52;
                            chk = true;
                            break;
                        case 37:
                            i = 53;
                            chk = true;
                            break;
                        case 38:
                            i = 54;
                            chk = true;
                            break;
                        case 39:
                            i = 39;
                            chk = true;
                            break;
                        case 40:
                            i = 56;
                            chk = true;
                            break;
                        case 41:
                            i = 57;
                            chk = true;
                            break;
                        case 42:
                            i = 42;
                            chk = true;
                            break;
                        case 43:
                            i = (int)_KeyEvent.VK_OEM_PLUS;
                            chk = true;
                            break;
                        case 44:
                            i = 44;
                            chk = true;
                            break;
                        case 45:
                            i = 45;
                            chk = true;
                            break;
                        case 46:
                            i = 46;
                            chk = true;
                            break;
                        case 47:
                            i = 47;
                            chk = true;
                            break;
                        case 58:
                            i = 58;
                            chk = true;
                            break;
                        case 59:
                            i = 59;
                            chk = true;
                            break;
                        case 60:
                            i = 60;
                            chk = true;
                            break;
                        case 61:
                            i = 61;
                            chk = true;
                            break;
                        case 62:
                            i = 62;
                            chk = true;
                            break;
                        case 63:
                            i = 63;
                            chk = true;
                            break;
                        case 94:
                            i = 94;
                            chk = false;
                            break;
                        case 123:
                            i = 91;
                            chk = true;
                            break;
                        case 124:
                            i = 124;
                            chk = false;
                            break;
                        case 125:
                            i = 93;
                            chk = true;
                            break;
                       case 65429:
                            i = (int)_KeyEvent.VK_NUMPAD7;
                            chk = true;
                            break;
                        case 65430:
                            i = (int)_KeyEvent.VK_NUMPAD4;
                            chk = true;
                            break;
                        case 65431:
                            i = (int)_KeyEvent.VK_NUMPAD8;
                            chk = true;
                            break;
                        case 65432:
                            i = (int)_KeyEvent.VK_NUMPAD6;
                            chk = true;
                            break;
                        case 65433:
                            i = (int)_KeyEvent.VK_NUMPAD2;
                            chk = true;
                            break;
                        case 65434:
                            i = (int)_KeyEvent.VK_NUMPAD9;
                            chk = true;
                            break;
                        case 65435:
                            i = (int)_KeyEvent.VK_NUMPAD3;
                            chk = true;
                            break;
                        case 65436:
                            i = (int)_KeyEvent.VK_NUMPAD1;
                            chk = true;
                            break;
                        case 65437:
                            i = (int)_KeyEvent.VK_NUMPAD5;
                            chk = true;
                            break;
                        case 65438:
                             i = (int)_KeyEvent.VK_NUMPAD0;
                            chk = true;
                            break;
                        default:
                            i = toVKall(paramInt);
                            break;
                    }
                }
                if (i != 0)
                {
                    localKeyCode = new KeyCode();
                    localKeyCode.key = i;
                    localKeyCode.isShift = chk;
                }
                return localKeyCode;
            }
Aug 15, 2013 at 7:34 PM
Part 2
``` public static string vkToString(int vk)
        {
            Console.WriteLine(vk);
            char[] c = new char[1];
            if (vk >= '0' && vk <= '9')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk >= 'A' && vk <= 'Z')
            {
                c[0] = (char)vk;
                return new String(c).ToLower();
            }
            if (vk == '.')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == ',')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == 'è')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == 'é')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '§')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '+')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '^')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '-')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '_')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == 'ò')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '°')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == 'ì')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '^')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '\\')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '(')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == ')')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '[')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == ']')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '%')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '&')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '#')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '$')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '\'')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '/')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '£')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == '€')
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == 40)
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == 41)
            {
                c[0] = (char)vk;
                return new String(c);
            }
            if (vk == 94)
            {
                return "^";
            }
            if (vk == 96)
            {
                c[0] = '`';
                return new String(c);
            }
            if (vk == 123)
            {
                return "{";
            }
            if (vk == 124)
            {
                return "|";
            }
            if (vk == 125)
            {
                return "}";
            }
            if (vk == 126)
            {
                return "~";
            }
            if (vk == 127)
            {
                c[0] = '⌂';
                return new String(c);
            }
            if (vk == 128)
            {
                c[0] = 'Ç';
                return new String(c);
            }
            if (vk == 129)
            {
                c[0] = 'ü';
                return new String(c);
            }
            if (vk == 130)
            {
                c[0] = 'é';
                return new String(c);
            }
            if (vk == 131)
            {
                c[0] = 'â';
                return new String(c);
            }
            if (vk == 132)
            {
                c[0] = 'ä';
                return new String(c);
            }
            if (vk == 133)
            {
                c[0] = 'à';
                return new String(c);
            }
            if (vk == 134)
            {
                c[0] = 'å';
                return new String(c);
            }
            if (vk == 135)
            {
                c[0] = 'ç';
                return new String(c);
            }
            if (vk == 136)
            {
                c[0] = 'ê';
                return new String(c);
            }
            if (vk == 137)
            {
                c[0] = 'ë';
                return new String(c);
            }
            if (vk == 138)
            {
                c[0] = 'è';
                return new String(c);
            }
            if (vk == 139)
            {
                c[0] = 'ï';
                return new String(c);
            }
            if (vk == 140)
            {
                c[0] = 'î';
                return new String(c);
            }
            if (vk == 141)
            {
                c[0] = 'ì';
                return new String(c);
            }
            if (vk == 142)
            {
                c[0] = 'Ä';
                return new String(c);
            }
            if (vk == 143)
            {
                c[0] = 'Å';
                return new String(c);
            }
            if (vk == 144)
            {
                c[0] = 'É';
                return new String(c);
            }
            if (vk == 145)
            {
                c[0] = 'æ';
                return new String(c);
            }
            if (vk == 146)
            {
                c[0] = 'Æ';
                return new String(c);
            }
            if (vk == 147)
            {
                c[0] = 'ô';
                return new String(c);
            }
            if (vk == 148)
            {
                c[0] = 'ö';
                return new String(c);
            }
            if (vk == 149)
            {
                c[0] = 'ò';
                return new String(c);
            }
            if (vk == 150)
            {
                c[0] = 'û';
                return new String(c);
            }
Aug 15, 2013 at 7:36 PM
Part 3:
 if (vk == '!')
                {
                    c[0] = (char)vk;
                    return new String(c);
                }
                if (vk == '+')
                {
                    c[0] = (char)vk;
                    return "+";
                }
                if (vk == 32)
                {
                    c[0] = (char)vk;
                    return new String(c);
                }
                if (vk == '\"')
                {
                    c[0] = (char)vk;
                    return new String(c);
                }

                if (vk == 65360)
                {
                    vk = (int)_KeyEvent.VK_HOME;
                }
                if (vk == 65361)
                {
                    vk = (int)_KeyEvent.VK_LEFT; 
                }
                if (vk == 65363)
                {
                    vk = (int)_KeyEvent.VK_RIGHT; 
                }
                if (vk == 65362)
                {
                    vk = (int)_KeyEvent.VK_UP; 
                }
                if (vk == 65364)
                {
                    vk = (int)_KeyEvent.VK_DOWN;
                }
                if (vk == 65365)
                {
                    vk = (int)_KeyEvent.VK_PRIOR;
                }
                if (vk == 65366)
                {
                    vk = (int)_KeyEvent.VK_NEXT;
                }
                if (vk == 65367)
                {
                    vk = (int)_KeyEvent.VK_END;
                }
                if (vk == 65293)
                {
                    vk = (int)_KeyEvent.VK_RETURN; 
                }
                if (vk == 65535)
                {
                    vk = (int)_KeyEvent.VK_DELETE;
                }
                switch (vk)
                {
                    case (int)_KeyEvent.VK_TAB:
                        return "{TAB}";
                    case (int)_KeyEvent.VK_RETURN:
                        return "{ENTER}";

                    //caseStringify(VK_CLEAR);
                    case (int)_KeyEvent.VK_LSHIFT:
                        return "+";
                    case (int)_KeyEvent.VK_RSHIFT:
                        return "+";
                    case (int)_KeyEvent.VK_SHIFT:
                        return "+";

                    //caseStringify(VK_CONTROL);
                    case (int)_KeyEvent.VK_LCONTROL:
                        return "^";
                    case (int)_KeyEvent.VK_RCONTROL:
                        return "^";
                    case (int)_KeyEvent.VK_CONTROL:
                        return "^";

                    case (int)_KeyEvent.VK_LMENU:
                        return "%";
                    case (int)_KeyEvent.VK_RMENU:
                        return "%";
                    case (int)_KeyEvent.VK_MENU:
                        return "%";

                    //caseStringify(VK_PAUSE);
                    case (int)_KeyEvent.VK_CAPITAL:
                        return "{CAPSLOCK}";
                    case (int)_KeyEvent.VK_ESCAPE:
                        return "{ESC}";
                    case (int)_KeyEvent.VK_SPACE:
                        return "{SPACE}";
                    case (int)_KeyEvent.VK_PRIOR:
                        return "{PGUP}";
                    case (int)_KeyEvent.VK_NEXT:
                        return "{PGDN}";
                    case (int)_KeyEvent.VK_END:
                        return "{END}";
                    case (int)_KeyEvent.VK_HOME:
                        return "{HOME}";
                    case (int)_KeyEvent.VK_LEFT:
                        return "{LEFT}";
                    case (int)_KeyEvent.VK_UP:
                        return "{UP}";
                    case (int)_KeyEvent.VK_RIGHT:
                        return "{RIGHT}";
                    case (int)_KeyEvent.VK_DOWN:
                        return "{DOWN}";

                    //caseStringify(VK_SELECT);
                    //caseStringify(VK_EXECUTE);

                    case (int)_KeyEvent.VK_SNAPSHOT:
                        return "{PRTSC}";
                    case (int)_KeyEvent.VK_INSERT:
                        return "{INSERT}";
                    case (int)_KeyEvent.VK_DELETE:
                        return "{DELETE}";
                    case (int)_KeyEvent.VK_HELP:
                        return "{HELP}";
                    case ((int)_KeyEvent.VK_LWIN | (int)_KeyEvent.VK_RWIN):
                        return "^{ESC}";

                    //caseStringify(VK_APPS);
                    //caseStringify(VK_SLEEP);

                    case (int)_KeyEvent.VK_NUMPAD0:
                        return "0";
                    case (int)_KeyEvent.VK_NUMPAD1:
                        return "1";
                    case (int)_KeyEvent.VK_NUMPAD2:
                        return "2";
                    case (int)_KeyEvent.VK_NUMPAD3:
                        return "3";
                    case (int)_KeyEvent.VK_NUMPAD4:
                        return "4";
                    case (int)_KeyEvent.VK_NUMPAD5:
                        return "5";
                    case (int)_KeyEvent.VK_NUMPAD6:
                        return "6";
                    case (int)_KeyEvent.VK_NUMPAD7:
                        return "7";
                    case (int)_KeyEvent.VK_NUMPAD8:
                        return "8";
                    case (int)_KeyEvent.VK_NUMPAD9:
                        return "9";

                    case (int)_KeyEvent.VK_MULTIPLY:
                        return "{MULTIPLY}";
                    case (int)_KeyEvent.VK_ADD:
                        return "{ADD}";
                    case (int)_KeyEvent.VK_SUBTRACT:
                        return "{SUBTRACT}";
                    case (int)_KeyEvent.VK_DIVIDE:
                        return "{DIVIDE}";

                    //caseStringify(VK_SEPARATOR);
                    //caseStringify(VK_DECIMAL);
                    case (int)_KeyEvent.VK_F1:
                        return "{F1}";
                    case (int)_KeyEvent.VK_F2:
                        return "{F2}";
                    case (int)_KeyEvent.VK_F3:
                        return "{F3}";
                    case (int)_KeyEvent.VK_F4:
                        return "{F4}";
                    case (int)_KeyEvent.VK_F5:
                        return "{F5}";
                    case (int)_KeyEvent.VK_F6:
                        return "{F6}";
                    case (int)_KeyEvent.VK_F7:
                        return "{F7}";
                    case (int)_KeyEvent.VK_F8:
                        return "{F8}";
                    case (int)_KeyEvent.VK_F9:
                        return "{F9}";
                    case (int)_KeyEvent.VK_F10:
                        return "{F10}";
                    case (int)_KeyEvent.VK_F11:
                        return "{F11}";
                    case (int)_KeyEvent.VK_F12:
                        return "{F12}";
                    case (int)_KeyEvent.VK_F13:
                        return "{F13}";
                    case (int)_KeyEvent.VK_F14:
                        return "{F14}";
                    case (int)_KeyEvent.VK_F15:
                        return "{F15}";
                    case (int)_KeyEvent.VK_F16:
                        return "{F16}";

                    case (int)_KeyEvent.VK_NUMLOCK:
                        return "{NUMLOCK}";
                    case (int)_KeyEvent.VK_SCROLL:
                        return "{SCROLLLOCK}";
  case (int)_KeyEvent.VK_OEM_PLUS:
                        return "{+}";
                    case (int)_KeyEvent.VK_OEM_MINUS:
                        return "{-}";
                    case (int)_KeyEvent.VK_OEM_COMMA:
                        return ",";
                    case (int)_KeyEvent.VK_OEM_PERIOD:
                        return ".";
                    case (int)_KeyEvent.VK_OEM_2:
                        return "{DIVIDE}"; //or ?
                    case (int)_KeyEvent.VK_OEM_3:
                        return "{~}";
                    case (int)_KeyEvent.VK_OEM_4:
                        return "{[}";
                    case (int)_KeyEvent.VK_OEM_6:
                        return "{]}";

                    //caseStringify(VK_OEM_5);  //  '\|' for US
                    //caseStringify(VK_OEM_7);  //  ''"' for US
                    //caseStringify(VK_OEM_102);  //  "<>" or "\|" on RT 102-key kbd.
                }
                c[0] = (char)vk;
                return new String(c);
            }
Coordinator
Feb 21, 2014 at 4:11 AM
Thank you for your feedback !
I do not use the Italian keymap, so I have not thought to test it.
Thank you for modifying the code to work with your native keymap.
I have tested it and merged it into the code. It will be visible in the next commit.

Regards,
T1T4N
Feb 21, 2014 at 1:58 PM
Please wait before upload code. When developing my proprietary solution for remote desktop, not based with NVNC becasue I need other license and I made from scartch my custom solution, I see keyb_event and mouse_event are deprecated. Need to use sendinput instead of keyb_event and mouse_event. I see also how I can send keyboard code directly and not map needed for keyboard control. In my code keyboard work with system keyboard map and not needed to map Keys. Subroutine is more little and stable. I think to provide code with email this weekend. But because is not modified from your code I think best way for prevent license issue because my code is not under GPL and I won't generate conflict with your license. I need my compiled application under copyrighted licensed, if I provide code now I'm not shure if integrated in your applicaton, my code become under GPL!

Thanks
Coordinator
Feb 21, 2014 at 2:02 PM
Hello fabcal,

I am sorry but I didn't understand you.
Is the current piece of code that you wrote above licensed and proprietary, or the other solution you have with sendInput ?

Regards,
T1T4N
Feb 21, 2014 at 2:19 PM
Edited Feb 22, 2014 at 3:57 PM
I think, I provide code without any restriction. Only my application not become under GPL!! Ok?

Note: My company is a developer company. Property of code is my company (I'm member and legal administrator!). My company not develop code under GPL for some projects. My interest is only prevent conflict with our commercial license when provide our piece of code! Do you mean? Sorry for my bad english
Feb 21, 2014 at 2:21 PM
Edited Feb 22, 2014 at 3:58 PM
Good worki T1T4N! :-) I'm happy for this release. Great!