def _parameters(self, is_press): """The parameters to pass to ``SendInput`` to generate this key. :param bool is_press: Whether to generate a press event. :return: all arguments to pass to ``SendInput`` for this key :rtype: dict """ if self.vk: vk = self.vk scan = 0 flags = 0 else: res = VkKeyScan(self.char) if (res >> 8) & 0xFF == 0: vk = res & 0xFF scan = 0 flags = 0 else: vk = 0 scan = ord(self.char) flags = KEYBDINPUT.UNICODE return dict( dwFlags=flags | (KEYBDINPUT.KEYUP if not is_press else 0), wVk=vk, wScan=scan)
def _parameters(self, is_press): """The parameters to pass to ``SendInput`` to generate this key. :param bool is_press: Whether to generate a press event. :return: all arguments to pass to ``SendInput`` for this key :rtype: dict """ if self.vk: vk = self.vk scan = self._scan \ or MapVirtualKey(vk, MapVirtualKey.MAPVK_VK_TO_VSC) flags = 0 else: res = VkKeyScan(self.char) if (res >> 8) & 0xFF == 0: vk = res & 0xFF scan = self._scan \ or MapVirtualKey(vk, MapVirtualKey.MAPVK_VK_TO_VSC) flags = 0 else: vk = 0 scan = ord(self.char) flags = KEYBDINPUT.UNICODE state_flags = (KEYBDINPUT.KEYUP if not is_press else 0) return dict( dwFlags=(self._flags or 0) | flags | state_flags, wVk=vk, wScan=scan)