public static NKeyCode GetKeyCode(uint lParam, uint wParam) { byte virtualKey = (byte)wParam; bool isExtended = (lParam & 0x01000000) != 0; if (virtualKey == VK_SHIFT) { byte scanCode = (byte)(lParam >> 16); virtualKey = (byte)Win32API.MapVirtualKeyW(scanCode, VirtualKeyMapType.MAPVK_VSC_TO_VK_EX); return(GetKeyCode(virtualKey, isExtended)); } return(GetKeyCode(virtualKey, isExtended)); }