Python win32con 模块,VK_MENU 实例源码

我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用win32con.VK_MENU

项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def OnKeyDown(self, msg):
        key = msg[2]
        if win32api.GetKeyState(win32con.VK_CONTROL) & 0x8000:
            modList = MODIFYING_VK_KEYS_CTRL
        elif win32api.GetKeyState(win32con.VK_MENU) & 0x8000:
            modList = MODIFYING_VK_KEYS_ALT
        else:
            modList = MODIFYING_VK_KEYS

        if key in modList:
            # Return 1 if we can make the file editable.(or it already is!)
            return self.GetDocument().CheckMakeDocumentWritable()
        return 1 # Pass it on OK

#   def OnKey(self, key):
#       return self.GetDocument().CheckMakeDocumentWritable()
项目:remoteControlPPT    作者:htwenning    | 项目源码 | 文件源码
def fire_key_event(self, msg):
        key = msg[2]
        keyState = 0
        if win32api.GetKeyState(win32con.VK_CONTROL) & 0x8000:
            keyState = keyState | win32con.RIGHT_CTRL_PRESSED | win32con.LEFT_CTRL_PRESSED
        if win32api.GetKeyState(win32con.VK_SHIFT) & 0x8000:
            keyState = keyState | win32con.SHIFT_PRESSED
        if win32api.GetKeyState(win32con.VK_MENU) & 0x8000:
            keyState = keyState | win32con.LEFT_ALT_PRESSED | win32con.RIGHT_ALT_PRESSED
        keyinfo = key, keyState
        # Special hacks for the dead-char key on non-US keyboards.
        # (XXX - which do not work :-(
        event = self.keymap.get( keyinfo )
        if event is None:
                return 1
        return self.fire(event, None)
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def OnKeyDown(self, msg):
        key = msg[2]
        if win32api.GetKeyState(win32con.VK_CONTROL) & 0x8000:
            modList = MODIFYING_VK_KEYS_CTRL
        elif win32api.GetKeyState(win32con.VK_MENU) & 0x8000:
            modList = MODIFYING_VK_KEYS_ALT
        else:
            modList = MODIFYING_VK_KEYS

        if key in modList:
            # Return 1 if we can make the file editable.(or it already is!)
            return self.GetDocument().CheckMakeDocumentWritable()
        return 1 # Pass it on OK

#   def OnKey(self, key):
#       return self.GetDocument().CheckMakeDocumentWritable()
项目:CodeReader    作者:jasonrbr    | 项目源码 | 文件源码
def fire_key_event(self, msg):
        key = msg[2]
        keyState = 0
        if win32api.GetKeyState(win32con.VK_CONTROL) & 0x8000:
            keyState = keyState | win32con.RIGHT_CTRL_PRESSED | win32con.LEFT_CTRL_PRESSED
        if win32api.GetKeyState(win32con.VK_SHIFT) & 0x8000:
            keyState = keyState | win32con.SHIFT_PRESSED
        if win32api.GetKeyState(win32con.VK_MENU) & 0x8000:
            keyState = keyState | win32con.LEFT_ALT_PRESSED | win32con.RIGHT_ALT_PRESSED
        keyinfo = key, keyState
        # Special hacks for the dead-char key on non-US keyboards.
        # (XXX - which do not work :-(
        event = self.keymap.get( keyinfo )
        if event is None:
                return 1
        return self.fire(event, None)
项目:PyUIA    作者:xiaoxiayu    | 项目源码 | 文件源码
def generateVirtualKey(self, key):
        keyMap = {
            "left": win32con.VK_LEFT,
            "down": win32con.VK_DOWN,
            "tab" : win32con.VK_TAB,
            "up": win32con.VK_UP,
            "right": win32con.VK_RIGHT,
            "ctrl" : win32con.VK_CONTROL,
            "esc" : win32con.VK_ESCAPE,
            "enter" : win32con.VK_RETURN,
            "alt" : win32con.VK_MENU,
            ";:" : 0xBA,
            "\\|" : 0xDC,
            ".>" : 0xBE,
            "-_" : 0xBD,
            "win" : 0x5B,
            "shift" : win32con.VK_SHIFT
        }
        if key in keyMap:
            return keyMap[key]
        else:
            return ord(key.upper())
项目:pikaRL    作者:kooock    | 项目源码 | 文件源码
def game_reset(self):
        #?? ?? ???????? ? ????
        win32api.keybd_event(win32con.VK_MENU, 0, 0, 0) #alt down
        time.sleep(self.interval_time)
        win32api.keybd_event(win32con.VK_MENU, 0, win32con.KEYEVENTF_KEYUP, 0) #alt up
        win32api.keybd_event(0x47, 0, 0, 0) # key'G' down
        time.sleep(0.01)
        win32api.keybd_event(0x47, 0, win32con.KEYEVENTF_KEYUP, 0) # key 'G' up
        win32api.keybd_event(0x52, 0, 0, 0) # key 'R' down
        time.sleep(0.01)
        win32api.keybd_event(0x52, 0, win32con.KEYEVENTF_KEYUP, 0) # key 'R' up
        self.game_start()
项目:CNKI-QQFriend    作者:hsluoyz    | 项目源码 | 文件源码
def QQ_ToggleMessageRecord():
    win32api.keybd_event(win32con.VK_MENU, 0, 0, 0);
    win32api.keybd_event(ord('H'), 0, 0, 0);
    win32api.keybd_event(ord('H'), 0, win32con.KEYEVENTF_KEYUP, 0);
    win32api.keybd_event(win32con.VK_MENU, 0, win32con.KEYEVENTF_KEYUP, 0);

# Copy the last message.
项目:CNKI-QQFriend    作者:hsluoyz    | 项目源码 | 文件源码
def QQ_CloseWindow():
    win32api.keybd_event(win32con.VK_MENU, 0, 0, 0);
    win32api.keybd_event(win32con.VK_F4, 0, 0, 0);
    win32api.keybd_event(win32con.VK_F4, 0, win32con.KEYEVENTF_KEYUP, 0);
    win32api.keybd_event(win32con.VK_MENU, 0, win32con.KEYEVENTF_KEYUP, 0);

# Get the clipboard into a str.